Welcome to Centmin Mod Community
Register Now

Docker Memcached CentOS 7.0 + Memcached 1.4.22 Docker Image

Discussion in 'Centmin Mod Docker Development' started by eva2000, Feb 22, 2015.

  1. eva2000

    eva2000 Administrator Staff Member

    54,368
    12,198
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,763
    Local Time:
    10:35 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Like the CentOS 6.6 Memcached Docker Image version, this one is the CentOS 7.0 Memcached Docker Image version built on REMI YUM repositories Memached 1.4.22 version on CentOS 7.0 64bit OS for use with Centmin Mod LEMP web stacks.
    Grab from Docker Hub

    Code:
    docker pull centminmod/docker-centos7-memcached
    
    Run docker container

    Code:
    docker run -d -p 11211:11211 -t centminmod/docker-centos7-memcached
    
    or specify a name e.g. memc1

    Code:
    docker run --name memc1 -d -p 11211:11211 -t centminmod/docker-centos7-memcached
    
    or map to 33211 local host port

    Code:
    docker run --name memc1 -d -p 33211:11211 -t centminmod/docker-centos7-memcached
    
    or allocate a custom memory limit and settings e.g. 512MB memory

    Code:
    docker run --name memc1 -d -p 33211:11211 -t centminmod/docker-centos7-memcached memcached -m 512
    
    or allocate a custom memory limit and settings e.g. 512MB memory and 2 threads

    Code:
    docker run --name memc1 -d -p 33211:11211 -t centminmod/docker-centos7-memcached memcached -m 512 -t 2
    
    to access container via bash if started with name = memc1

    Code:
    docker exec -ti memc1 /bin/bash
    
    From host system connecting Memcached docker container's Memcached server stats via docker0 network interfaces IP address

    Code:
    ifconfig docker0 | grep 'inet '
    inet addr:172.17.42.1  Bcast:0.0.0.0  Mask:255.255.0.0
    
    Code:
    memcached-tool 172.17.42.1:11211 stats
    #172.17.42.1:11211 Field       Value
             accepting_conns           1
                   auth_cmds           0
                 auth_errors           0
                       bytes           0
                  bytes_read           7
               bytes_written           0
                  cas_badval           0
                    cas_hits           0
                  cas_misses           0
                   cmd_flush           0
                     cmd_get           0
                     cmd_set           0
                   cmd_touch           0
                 conn_yields           0
       connection_structures           7
           crawler_reclaimed           0
            curr_connections           6
                  curr_items           0
                   decr_hits           0
                 decr_misses           0
                 delete_hits           0
               delete_misses           0
           evicted_unfetched           0
                   evictions           0
           expired_unfetched           0
                    get_hits           0
                  get_misses           0
                  hash_bytes      524288
           hash_is_expanding           0
            hash_power_level          16
                   incr_hits           0
                 incr_misses           0
                    libevent 2.0.21-stable
              limit_maxbytes    67108864
         listen_disabled_num           0
           lrutail_reflocked           0
                malloc_fails           0
                         pid           1
                pointer_size          64
                   reclaimed           0
                reserved_fds          10
               rusage_system    0.012998
                 rusage_user    0.004999
       slab_reassign_running           0
                 slabs_moved           0
                     threads           2
                        time  1424559801
           total_connections           7
                 total_items           0
                  touch_hits           0
                touch_misses           0
                      uptime          60
                     version      1.4.22


     
    Last edited: Feb 23, 2015
  2. eva2000

    eva2000 Administrator Staff Member

    54,368
    12,198
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,763
    Local Time:
    10:35 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Twemperf aka mcperf memcached benchmarks against CentOS 7 Memcached Docker image instance - ended up with similar performance to CentOS 6.6 Memcached Docker image instance.

    Code:
    mcperf -s 172.17.42.1 -p 11211 --num-conns=5000 --conn-rate=20000 --sizes=0.01 --num-calls=10; echo; echo stats | nc 172.17.42.1 11211; echo
    
    Total: connections 5000 requests 43560 responses 43560 test-duration 0.494 s
    
    Connection rate: 10129.7 conn/s (0.1 ms/conn <= 4016 concurrent connections)
    Connection time [ms]: avg 313.7 min 1.8 max 368.5 stddev 61.00
    Connect time [ms]: avg 48.2 min 0.0 max 101.3 stddev 27.91
    
    Request rate: 88250.0 req/s (0.0 ms/req)
    Request size [B]: avg 129.0 min 129.0 max 129.0 stddev 0.00
    
    Response rate: 88250.0 rsp/s (0.0 ms/rsp)
    Response size [B]: avg 8.0 min 8.0 max 8.0 stddev 0.00
    Response time [ms]: avg 26.5 min 0.0 max 69.8 stddev 0.01
    Response time [ms]: p25 21.0 p50 25.0 p75 29.0
    Response time [ms]: p95 62.0 p99 69.0 p999 70.0
    Response type: stored 43560 not_stored 0 exists 0 not_found 0
    Response type: num 0 deleted 0 end 0 value 0
    Response type: error 0 client_error 0 server_error 0
    
    Errors: total 644 client-timo 0 socket-timo 0 connrefused 0 connreset 644
    Errors: fd-unavail 0 ftab-full 0 addrunavail 0 other 0
    
    CPU time [s]: user 0.04 system 0.45 (user 7.9% system 91.4% total 99.3%)
    Net I/O: bytes 5.7 MB rate 11806.9 KB/s (96.7*10^6 bps)
    
    
    STAT pid 1
    STAT uptime 10
    STAT time 1424562851
    STAT version 1.4.22
    STAT libevent 2.0.21-stable
    STAT pointer_size 64
    STAT rusage_user 0.100984
    STAT rusage_system 0.654900
    STAT curr_connections 6
    STAT total_connections 4363
    STAT connection_structures 4080
    STAT reserved_fds 10
    STAT cmd_get 0
    STAT cmd_set 43560
    STAT cmd_flush 0
    STAT cmd_touch 0
    STAT get_hits 0
    STAT get_misses 0
    STAT delete_misses 0
    STAT delete_hits 0
    STAT incr_misses 0
    STAT incr_hits 0
    STAT decr_misses 0
    STAT decr_hits 0
    STAT cas_misses 0
    STAT cas_hits 0
    STAT cas_badval 0
    STAT touch_hits 0
    STAT touch_misses 0
    STAT auth_cmds 0
    STAT auth_errors 0
    STAT bytes_read 5619246
    STAT bytes_written 348480
    STAT limit_maxbytes 67108864
    STAT accepting_conns 1
    STAT listen_disabled_num 1
    STAT threads 2
    STAT conn_yields 0
    STAT hash_power_level 16
    STAT hash_bytes 524288
    STAT hash_is_expanding 0
    STAT slab_reassign_running 0
    STAT slabs_moved 0
    STAT malloc_fails 0
    STAT bytes 7797240
    STAT curr_items 43560
    STAT total_items 43560
    STAT expired_unfetched 0
    STAT evicted_unfetched 0
    STAT evictions 0
    STAT reclaimed 0
    STAT crawler_reclaimed 0
    STAT lrutail_reflocked 0
    END
     
  3. eva2000

    eva2000 Administrator Staff Member

    54,368
    12,198
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,763
    Local Time:
    10:35 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    memtier_benchmark against CentOS 7.0 Memcached Docker container instance again similar performance to CentOS 6.6 Memcached Docker container instance.

    Code:
    c=50; time memtier_benchmark -P memcache_text -s 172.17.42.1 -p 11211 -c $c --random-data --data-size-range=4-204 --data-size-pattern=S --key-minimum=200 --key-maximum=400 --key-pattern=G:G --key-stddev=10 --key-median=300 2>&1 > memtier_benchmark.${c}.log; head -8 memtier_benchmark.${c}.log; echo; echo stats | nc 172.17.42.1 11211
    
    real    0m13.014s
    user    0m9.623s
    sys     0m19.735s
    4         Threads
    50        Connections per thread
    10000     Requests per thread
    Type        Ops/sec     Hits/sec   Misses/sec      Latency       KB/sec
    ------------------------------------------------------------------------
    Sets       16144.29          ---          ---      1.12900      2180.27
    Gets      161265.44    152575.56      8689.88      1.12400     22842.00
    Totals    177409.73    152575.56      8689.88      1.12500     25022.27
    
    STAT pid 1
    STAT uptime 20
    STAT time 1424562878
    STAT version 1.4.22
    STAT libevent 2.0.21-stable
    STAT pointer_size 64
    STAT rusage_user 1.854718
    STAT rusage_system 22.120637
    STAT curr_connections 6
    STAT total_connections 207
    STAT connection_structures 206
    STAT reserved_fds 10
    STAT cmd_get 1818000
    STAT cmd_set 182000
    STAT cmd_flush 0
    STAT cmd_touch 0
    STAT get_hits 1720036
    STAT get_misses 97964
    STAT delete_misses 0
    STAT delete_hits 0
    STAT incr_misses 0
    STAT incr_hits 0
    STAT decr_misses 0
    STAT decr_hits 0
    STAT cas_misses 0
    STAT cas_hits 0
    STAT cas_badval 0
    STAT touch_hits 0
    STAT touch_misses 0
    STAT auth_cmds 0
    STAT auth_errors 0
    STAT bytes_read 54618806
    STAT bytes_written 234235722
    STAT limit_maxbytes 67108864
    STAT accepting_conns 1
    STAT listen_disabled_num 0
    STAT threads 2
    STAT conn_yields 0
    STAT hash_power_level 16
    STAT hash_bytes 524288
    STAT hash_is_expanding 0
    STAT slab_reassign_running 0
    STAT slabs_moved 0
    STAT malloc_fails 0
    STAT bytes 9982
    STAT curr_items 55
    STAT total_items 182000
    STAT expired_unfetched 0
    STAT evicted_unfetched 0
    STAT evictions 0
    STAT reclaimed 0
    STAT crawler_reclaimed 0
    STAT lrutail_reflocked 1083
    END
     
  4. eva2000

    eva2000 Administrator Staff Member

    54,368
    12,198
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,763
    Local Time:
    10:35 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Just optimized my resulting CentOS 7 Memcached server docker image size by 33% from 414MB to 274MB :)

    Code:
    docker images
    REPOSITORY                      TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
    centminmod-memcached7min        latest              xxx        2 minutes ago       274 MB
    centminmod-memcached7           latest              yyy        14 hours ago        414.3 MB
     
  5. eva2000

    eva2000 Administrator Staff Member

    54,368
    12,198
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,763
    Local Time:
    10:35 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  6. Kyvaith

    Kyvaith New Member

    10
    1
    3
    Jun 14, 2016
    Ratings:
    +2
    Local Time:
    1:35 PM
    Hi,

    Please check this docker: GitHub - million12/docker-nginx-php: Docker with Nginx / PHP-FPM 7, 5.6, 5.5. CentOS-7 based.

    Those guys have done even more great job, have a look at their github profile:
    • million12/haproxy Docker image with HAProxy with ALPN and HTTP/2 support.
    • million12/nginx Docker image with Nginx with HTTP/2 support.
    • million12/nginx-php Docker image with PHP-FPM 5.6 and 7.0, based on million12/nginx.
    • million12/php-app-ssh side container with SSH for million12/nginx-php. Good while developing app inside million12/nginx-php and SSH access is needed for file changes upload.
    Would be grate if you find some time to fork this code and add your optimizations form Centmin Mod. After creating webserver container, with could be multiplied for each vhost, we need Database docker (You've already started doing this), and Memcached one (also PoC ready).

    In future, You could add optimized containers with Node.JS, Ruby etc.. Having OOB script for easy of use of HAProxy for loadbalancing, and ie. Kubernetes for autoscaling would be also terrific.
     
  7. eva2000

    eva2000 Administrator Staff Member

    54,368
    12,198
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,763
    Local Time:
    10:35 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Yes it would be great unfortunately time, experience and priorities wise it can only be on my to do list as I only work on centmin mod in my spare time. But thanks for sharing those examples of docker usage

    From my limited experience though docker performance wise can be lower

    Would be nice to have more experienced docker folks chiming in and contributing eventually too though