Check if memcached is working as expected?

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • There are a couple of ways.
      There are several utilities out that will allow you to check, but what I do is run another process that allows me to access some statistical information via the web. It's called Monitorix.

      It provides information for 1 day periods and what I like about it is it is very lightweight.
      Screen Shot 2017-05-26 at 1.28.44 PM.png
      Screen Shot 2017-05-26 at 1.28.56 PM.png

      You can also check from the command line if you have netcat installed
      echo stats | nc 127.0.0.1 11211

      It will give you something similar to this

      Source Code

      1. echo stats | nc 127.0.0.1 11211
      2. STAT pid 2170
      3. STAT uptime 3543838
      4. STAT time 1495823495
      5. STAT version 1.4.34
      6. STAT libevent 2.0.22-stable
      7. STAT pointer_size 64
      8. STAT rusage_user 611.976945
      9. STAT rusage_system 528.140848
      10. STAT curr_connections 5
      11. STAT total_connections 213956
      12. STAT rejected_connections 0
      13. STAT connection_structures 31
      14. STAT reserved_fds 20
      15. STAT cmd_get 3562680
      16. STAT cmd_set 131079
      17. STAT cmd_flush 123
      18. STAT cmd_touch 0
      19. STAT get_hits 3506441
      20. STAT get_misses 56239
      21. STAT get_expired 6828
      22. STAT get_flushed 134
      23. STAT delete_misses 13472
      24. STAT delete_hits 4926
      25. STAT incr_misses 0
      26. STAT incr_hits 509
      27. STAT decr_misses 0
      28. STAT decr_hits 0
      29. STAT cas_misses 0
      30. STAT cas_hits 0
      31. STAT cas_badval 0
      32. STAT touch_hits 0
      33. STAT touch_misses 0
      34. STAT auth_cmds 0
      35. STAT auth_errors 0
      36. STAT bytes_read 796019330
      37. STAT bytes_written 13485154336
      38. STAT limit_maxbytes 1073741824
      39. STAT accepting_conns 1
      40. STAT listen_disabled_num 0
      41. STAT time_in_listen_disabled_us 0
      42. STAT threads 4
      43. STAT conn_yields 0
      44. STAT hash_power_level 16
      45. STAT hash_bytes 524288
      46. STAT hash_is_expanding 0
      47. STAT slab_reassign_rescues 0
      48. STAT slab_reassign_chunk_rescues 0
      49. STAT slab_reassign_evictions_nomem 0
      50. STAT slab_reassign_inline_reclaim 0
      51. STAT slab_reassign_busy_items 0
      52. STAT slab_reassign_running 0
      53. STAT slabs_moved 0
      54. STAT lru_crawler_running 0
      55. STAT lru_crawler_starts 67080
      56. STAT lru_maintainer_juggles 10870506
      57. STAT malloc_fails 0
      58. STAT log_worker_dropped 0
      59. STAT log_worker_written 0
      60. STAT log_watcher_skipped 0
      61. STAT log_watcher_sent 0
      62. STAT bytes 755298
      63. STAT curr_items 158
      64. STAT total_items 129645
      65. STAT slab_global_page_pool 0
      66. STAT expired_unfetched 33030
      67. STAT evicted_unfetched 0
      68. STAT evicted_active 0
      69. STAT evictions 0
      70. STAT reclaimed 34477
      71. STAT crawler_reclaimed 8322
      72. STAT crawler_items_checked 242311
      73. STAT lrutail_reflocked 144
      74. STAT moves_to_cold 122699
      75. STAT moves_to_warm 103972
      76. STAT moves_within_lru 540692
      77. STAT direct_reclaims 0
      78. END
      Display All
      If you have Bash's magic enabled then you can also do this (which will allow you to monitor it)
      watch 'php -r '"'"'$m=new Memcache;$m->connect("127.0.0.1", 11211);print_r($m->getstats());'"'"
      and it will give the statstistics (and update them every 2 seconds).