Giter Club home page Giter Club logo

12_concurrency's Introduction

MemcLoad

A script that concurrently load data to memcache Data files:

Install

  1. Before running script you need to install packages:
sudo apt install memcached python-protobuf protobuf-compiler
  1. Create virtual env
$ git clone https://github.com/ligain/12_concurrency
$ cd 12_concurrency/
$ python3.5 -m venv .env
$ . .env/bin/activate
  1. Install requirements
$ pip install -r requirements.txt

Run

$ python memc_load.py --pattern=/path/to/datafiles/*tsv.gz --dry

Performance delta

Single thread version:

$ python memc_load.py --pattern=/path/to/datafiles/*tsv.gz --dry
...
[2018.08.26 16:22:54] I Acceptable error rate (0.0). Successfull load

real    31m24.540s
user    16m53.012s
sys 0m52.976s

Multi processing version:

$ python memc_load.py --pattern=/path/to/datafiles/*tsv.gz --dry
...
[ProcessFile-2 MainThread 2018.08.31 22:23:41] I Acceptable error rate (0.0). Successful load
[ProcessFile-2 MainThread 2018.08.31 22:23:41] I Processed lines: 3424477
[MainProcess MainThread 2018.08.31 22:23:41] I Script completed in: 552.5402113620003 sec

real	9m12.765s
user	20m16.184s
sys	2m17.040s

Project Goals

The code is written for educational purposes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.