Advertisement
Guest User

Untitled

a guest
May 6th, 2010
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. brianm (dev) ~ # cat memcached.php
  2. <?php
  3.  
  4. $pid = getmypid();
  5.  
  6. for($x=0;$x<20;$x++) {
  7.  
  8. $mc = new Memcached("test");
  9. $mc->addServer("localhost", 11211);
  10. $mc->get("foo");
  11. unset($mc);
  12.  
  13. $connections = `lsof -n -p $pid | fgrep -c "11211"`;
  14.  
  15. echo "$x: $connections";
  16. }
  17.  
  18. ?>
  19. brianm (dev) ~ # php memcached.php
  20. 0: 1
  21. 1: 2
  22. 2: 2
  23. 3: 2
  24. 4: 2
  25. 5: 3
  26. 6: 3
  27. 7: 4
  28. 8: 4
  29. 9: 4
  30. 10: 5
  31. 11: 6
  32. 12: 6
  33. 13: 6
  34. 14: 6
  35. 15: 7
  36. 16: 7
  37. 17: 7
  38. 18: 8
  39. 19: 8
  40. brianm (dev) ~ # cat memcache.php
  41. <?php
  42.  
  43. $pid = getmypid();
  44.  
  45. for($x=0;$x<20;$x++) {
  46.  
  47. $mc = new Memcache();
  48. $mc->addServer("localhost", 11211, true);
  49. $mc->get("foo");
  50. unset($mc);
  51.  
  52. $connections = `lsof -n -p $pid | fgrep -c "11211"`;
  53.  
  54. echo "$x: $connections";
  55. }
  56.  
  57. ?>
  58. brianm (dev) ~ # php memcache.php
  59. 0: 1
  60. 1: 1
  61. 2: 1
  62. 3: 1
  63. 4: 1
  64. 5: 1
  65. 6: 1
  66. 7: 1
  67. 8: 1
  68. 9: 1
  69. 10: 1
  70. 11: 1
  71. 12: 1
  72. 13: 1
  73. 14: 1
  74. 15: 1
  75. 16: 1
  76. 17: 1
  77. 18: 1
  78. 19: 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement