Changeset 487
- Timestamp:
- 04/08/07 15:21:12 (2 years ago)
- Files:
-
- branches/multithreaded/server/ChangeLog (modified) (1 diff)
- branches/multithreaded/server/doc/protocol.txt (modified) (2 diffs)
- branches/multithreaded/server/items.c (modified) (1 diff)
- branches/multithreaded/server/memcached.c (modified) (4 diffs)
- branches/multithreaded/server/memcached.h (modified) (1 diff)
- branches/multithreaded/server/t/maxconns.t (modified) (2 diffs)
- branches/multithreaded/server/t/stats.t (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/multithreaded/server/ChangeLog
r474 r487 1 2007-03-18 Paul Lindner <lindner@mirth.inuus.com> 2 1 2007-04-04 Paul Lindner <lindner@inuus.com> 2 3 * Add clarification of flush_all in the protocol docs 4 from Elizabeth Mattijsen <liz@dijkmat.nl> 5 6 2007-03-31 Paul Lindner <lindner@inuus.com> 7 8 * Add patch from Eli Bingham <eli@pandora.com> to 9 re-enable the -n switch to memcached. 10 11 2007-03-20 Paul Lindner <lindner@inuus.com> 12 * Add patch to collect eviction statistics from 13 Jean-Francois BUSTARRET <jfbustarret@wat.tv>. 14 15 * Updated docs, added new test cases for t/stats.t 3 16 4 17 2007-03-18 Paul Lindner <lindner@inuus.com> branches/multithreaded/server/doc/protocol.txt
r357 r487 347 347 connection_structures 32u Number of connection structures allocated 348 348 by the server 349 cmd_get 32u Cumulative number of retrieval requests350 cmd_set 32u Cumulative number of storage requests351 get_hits 32u Number of keys that have been requested and349 cmd_get 64u Cumulative number of retrieval requests 350 cmd_set 64u Cumulative number of storage requests 351 get_hits 64u Number of keys that have been requested and 352 352 found present 353 get_misses 32u Number of items that have been requested353 get_misses 64u Number of items that have been requested 354 354 and not found 355 evictions 64u Number of items removed from cache because 356 they passed their expiration time 355 357 bytes_read 64u Total number of bytes read by this server 356 358 from network … … 377 379 executed to be ignored for retrieval purposes. 378 380 381 The intent of flush_all with a delay, was that in a setting where you 382 have a pool of memcached servers, and you need to flush all content, 383 you have the option of not resetting all memcached servers at the 384 same time (which could e.g. cause a spike in database load with all 385 clients suddenly needing to recreate content that would otherwise 386 have been found in the memcached daemon). 387 388 The delay option allows you to have them reset in e.g. 10 second 389 intervals (by passing 0 to the first, 10 to the second, 20 to the 390 third, etc. etc.). 391 392 379 393 "version" is a command with no arguments: 380 394 branches/multithreaded/server/items.c
r474 r487 108 108 for (search = tails[id]; tries>0 && search; tries--, search=search->prev) { 109 109 if (search->refcount==0) { 110 if (search->exptime > current_time) { 111 STATS_LOCK(); 112 stats.evictions++; 113 STATS_UNLOCK(); 114 } 110 115 do_item_unlink(search); 111 116 break; branches/multithreaded/server/memcached.c
r474 r487 147 147 static void stats_init(void) { 148 148 stats.curr_items = stats.total_items = stats.curr_conns = stats.total_conns = stats.conn_structs = 0; 149 stats.get_cmds = stats.set_cmds = stats.get_hits = stats.get_misses = 0;149 stats.get_cmds = stats.set_cmds = stats.get_hits = stats.get_misses = stats.evictions = 0; 150 150 stats.curr_bytes = stats.bytes_read = stats.bytes_written = 0; 151 151 … … 161 161 STATS_LOCK(); 162 162 stats.total_items = stats.total_conns = 0; 163 stats.get_cmds = stats.set_cmds = stats.get_hits = stats.get_misses = 0;163 stats.get_cmds = stats.set_cmds = stats.get_hits = stats.get_misses = stats.evictions = 0; 164 164 stats.bytes_read = stats.bytes_written = 0; 165 165 stats_prefix_clear(); … … 866 866 pos += sprintf(pos, "STAT get_hits %llu\r\n", stats.get_hits); 867 867 pos += sprintf(pos, "STAT get_misses %llu\r\n", stats.get_misses); 868 pos += sprintf(pos, "STAT evictions %llu\r\n", stats.evictions); 868 869 pos += sprintf(pos, "STAT bytes_read %llu\r\n", stats.bytes_read); 869 870 pos += sprintf(pos, "STAT bytes_written %llu\r\n", stats.bytes_written); … … 2425 2426 2426 2427 /* process arguments */ 2427 while ((c = getopt(argc, argv, "bp:s:U:m:Mc:khirvdl:u:P:f: t:D:")) != -1) {2428 while ((c = getopt(argc, argv, "bp:s:U:m:Mc:khirvdl:u:P:f:s:n:t:D:")) != -1) { 2428 2429 switch (c) { 2429 2430 case 'U': branches/multithreaded/server/memcached.h
r474 r487 55 55 unsigned long long get_hits; 56 56 unsigned long long get_misses; 57 unsigned long long evictions; 57 58 time_t started; /* when the process was started */ 58 59 unsigned long long bytes_read; branches/multithreaded/server/t/maxconns.t
r474 r487 4 4 use warnings; 5 5 6 use Test::More tests => 10;6 use Test::More tests => 21; 7 7 8 8 use FindBin qw($Bin); … … 19 19 push (@sockets, $sock); 20 20 21 foreach my $conn (1..20) { 21 22 foreach my $conn (1..10) { 22 23 $sock = $server->new_sock; 23 if ($conn > 10) { 24 ok(!defined($sock), "Failed Connection $conn $sock"); 25 } else { 26 ok(defined($sock), "Connection $conn"); 27 push(@sockets, $sock); 28 } 24 ok(defined($sock), "Made connection $conn"); 25 push(@sockets, $sock); 29 26 } 30 27 31 mem_stats($sock, ''); 32 sleep(100); 28 TODO: { 29 local $TODO = "Need to decide on what -c semantics are"; 30 31 foreach my $conn (11..20) { 32 $sock = $server->new_sock; 33 ok(defined($sock), "Connection $conn"); 34 push(@sockets, $sock); 35 } 36 } branches/multithreaded/server/t/stats.t
r351 r487 2 2 3 3 use strict; 4 use Test::More skip_all => "Tests not written."; # tests => 14 use Test::More tests => 16; 5 5 use FindBin qw($Bin); 6 6 use lib "$Bin/lib"; … … 10 10 my $sock = $server->sock; 11 11 12 13 ## Output looks like this: 14 ## 15 ## STAT pid 16293 16 ## STAT uptime 7 17 ## STAT time 1174419597 18 ## STAT version 1.2.1 19 ## STAT pointer_size 32 20 ## STAT rusage_user 0.012998 21 ## STAT rusage_system 0.119981 22 ## STAT curr_items 0 23 ## STAT total_items 0 24 ## STAT bytes 0 25 ## STAT curr_connections 1 26 ## STAT total_connections 2 27 ## STAT connection_structures 2 28 ## STAT cmd_get 0 29 ## STAT cmd_set 0 30 ## STAT get_hits 0 31 ## STAT get_misses 0 32 ## STAT evictions 0 33 ## STAT bytes_read 7 34 ## STAT bytes_written 0 35 ## STAT limit_maxbytes 67108864 36 37 my $stats = mem_stats($sock); 38 39 # Test number of keys 40 is(scalar(keys(%$stats)), 22, "22 stats values"); 41 42 # Test initial state 43 foreach my $key (qw(curr_items total_items bytes cmd_get cmd_set get_hits evictions get_misses bytes_written)) { 44 is($stats->{$key}, 0, "initial $key is zero"); 45 } 46 47 # Do some operations 48 49 print $sock "set foo 0 0 6\r\nfooval\r\n"; 50 is(scalar <$sock>, "STORED\r\n", "stored foo"); 51 mem_get_is($sock, "foo", "fooval"); 52 53 my $stats = mem_stats($sock); 54 55 foreach my $key (qw(total_items curr_items cmd_get cmd_set get_hits)) { 56 is($stats->{$key}, 1, "after one set/one get $key is 1"); 57 }
