summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Use a proper hash mask for item lock table14perfdormando2011-10-121-6/+24
| | | | | | Directly use the hash for accessing the table. Performance seems unchanged from before but this is more proper. It also scales the hash table a bit as worker threads are increased.
* push cache_lock deeper into item_alloc1.4.9-beta1dormando2011-10-052-2/+5
| | | | | easy win without restructuring item_alloc more: push the lock down after it's done fiddling with snprintf.
* use item partitioned lock for as much as possibledormando2011-10-055-53/+80
| | | | push cache_lock deeper into the abyss
* Remove the depth search from item_allocdormando2011-10-051-92/+50
| | | | | | | | | | | Code checked 50 items before checking up to 50 more items to expire one, if none were expired. Given the shallow depth search (50) by any sizeable cache (as low as 1000 items, even), I believe that whole optimization was pointless. Flattening it to be a single test is shorter code and benches a bit faster as it holds the lock for less time. I may have made a mess of the logic, could be cleaned up a little.
* move hash calls outside of cache_lockdormando2011-10-057-58/+69
| | | | | been hard to measure while using the intel hash (since it's very fast), but should help with the software hash.
* Use spinlocks for main cache lockdormando2011-10-054-16/+23
| | | | | | | Partly by Ripduman Sohan Appears to significantly help prevent performance dropoff from additional threads, but only when the locks are frequently contested and are short.
* remove uncommon branch from asciiprot hot pathdormando2011-10-051-9/+15
| | | | | | The \0 test in the loop was accounting for 2% of memcached's CPU usage according to callgrind. strlen is an SSE4 instruction and can sniff out that null byte quickly.
* start-memcached writing wrong PID to $pidfile1.4.8Nate2011-10-041-9/+8
| | | | | after the doublefork was added, the pidfile was now of the intermediary pid, not the one forked after setsid.
* Add missing LRU bumps to binary get and othersdormando2011-10-041-0/+4
| | | | | | | | | An audit turned up that the LRU bump to move just accessed items to the front was missing from the binary get command. It was also missing from incr/decr and the new touch commands. If someone was using the binary protocol exclusively, memcached would be acting as a FIFO for stored items.
* upgrade stats items counters to 64bit1.4.8-rc1dormando2011-09-281-14/+14
| | | | 4 billion evictions should be enough for anybody!
* Add new stats expired_unfetched, evicted_unfetcheddormando2011-09-286-6/+47
| | | | | | | | | The two stats represent items which expired and memory was reused, and valid items which were evicted, but never touched by get/incr/append/etc operations in the meantime. Useful for seeing how many wasted items are being set and then rolling out through the bottom of the LRU's.
* Allow setting initial size of the hash tabledormando2011-09-284-6/+39
| | | | | | Instances which run many millions of items can now have its hash table presized. This can avoid some minor memory churn during the warmup period.
* expose stats for the internal hash tabledormando2011-09-284-0/+24
| | | | | | Now users can tell how much memory is being used for the hash table structure. It also exposes the current hash power level, which is useful for presizing the structure.
* bug220: incr would sometimes return the previous item's CASDustin Sallings2011-09-282-4/+39
| | | | | | This happens when we allocate a new item instead of reusing the space of an existing one, but consistently set the CAS from the original item's CAS (which is being discarded).
* port bin_get fixes to bin_touchdormando2011-09-281-0/+2
| | | | | without setting write_and_go, multiple commands in one packet weren't always being processed.
* Fixed multi get request also when key is foundDaniel Pañeda2011-09-281-0/+1
|
* Fixed bug on multi get processingDaniel Pañeda2011-09-281-0/+1
|
* experimental maxconns_fast optiondormando2011-09-278-11/+82
| | | | | | | | | | | | | Also fixes -c option to allow reducing the maximum connection limit. This gives a new option "-o maxconns_fast", which changes how memcached handles hitting the maximum connection limit. By default, it disables the accept listener and new connections will wait in the listen queue. With maxconns_fast enabled, new connections over the limited have an error written to them and are immediately closed by the listener thread. This is currently experimental, as we aren't sure how clients will handle the change. It may become the default in the future.
* update protocol.txt for touch commands, stats.dormando2011-09-271-0/+33
|
* Add an ASCII touch command.dormando2011-09-272-0/+69
| | | | | Not doing GAT for now since I'd have to iterate through gat/gats/multigat/etc. If there's demand, we can add it.
* Correctly use relative exptime for binary touchdormando2011-09-271-1/+1
|
* Add binary GATK/GATKQdormando2011-09-274-4/+37
| | | | | | | | Apparently nothing tests GETK/GETKQ, so tests still have to be added. 1.6 doesn't have GATK/GATKQ because the membase folks didn't need it. I'm adding them for completeness and because I don't want to argue about why people can't have it. If you're reading this, please use opaques :)
* Backport binary TOUCH/GAT/GATQ commandsdormando2011-09-2711-4/+249
| | | | | Taken from the 1.6 branch, partly written by Trond. I hope the CAS handling is correct.
* Issue 221: Increment treats leading spaces as 0Trond Norbye2011-09-032-4/+14
|
* Fix -rpath for macosxTrond Norbye2011-08-271-1/+1
|
* Do the monotonic clock ourselves1.4.7-rc11.4.7dormando2011-08-102-2/+26
| | | | | | | | | I've still removed the "set the time now" stuff that the flush_all commands do. They push to one second in the past, and with some startup fudge the tests all pass. Relying on libevent's firing of clock_handler was drifting ~5ms per tick. Fudging it further wouldn't be a great idea.
* Use a monotonically increasing timerdormando2011-08-101-17/+8
| | | | | | | | | | | | | | | | gettimeofday() can flip around all willy-nilly, and is actually common for users to cause this by having memcached start on boot before ntp launches and corrects system time. libevent fires events on a monotonically increasing clock, so we can more or less safely tick our internal timer up by one second every time the handler runs. Unfortunately we support expiration by date. If memcached's start time isn't in sync with the rest of the world this feature won't work well, but it never did. Was originally going to make this optional, but I can't come up with a great reason to do so. If it turns out this isn't "accurate enough", we can add the clock_gettime() code inline.
* t/issue_140.t waffle-fails. Make it not do that.dormando2011-08-101-1/+1
| | | | Dustin's set clock stuff would be nice :P
* Immediately expire negative exptime for asciiprotdormando2011-08-101-0/+6
| | | | | Negative values larger than the server start time used to become immortal. Now it's set to REALTIME_MAXDELTA + 1 in an attempt to immediately expire it.
* fix memcached-tool to print about all slabsdormando2011-08-101-1/+3
| | | | previously hardcoded to 40. now will iterate up through all of them.
* Properly daemonize memcached for debianClint Byrum2011-08-101-0/+8
| | | | | The debianish start script routes the STDERR/STDOUT to make "logfiles", but in doing so doesn't break free of the launching session. Patch fixes that.
* Don't permanently close UDP listeners on errordormando2011-08-101-1/+5
| | | | | | | | | | | | Also, don't inflate rbytes as we can only ever process one UDP packet at a time. Patch by pi3orama. Fixed by Dormando to use the correct state and actually work. I'm not fully convinced of the rbytes bit. We must ensure that a UDP packet with multiple commands in it has all of its commands processed before we can possibly call recvfrom again.
* adjust clean-whitespace to match t/whitespacedormando2011-08-101-1/+15
| | | | now fetches all the git files with the proper exemptions.
* Allow memcached-init to start multiple instancesGordon Franke2011-08-102-18/+64
| | | | | | | | Patch by Gordon Franke. Whitespace fixes and comments added by Dormando. There are many better ways to do this, but it doesn't break the default and the "status" command never existed. Servers can be started and stopped individually, and people seem to like the idea.
* remove ancient release filedormando2011-08-101-49/+0
|
* Issue 214: Search for network libraries before searching for libeventTrond Norbye2011-08-081-4/+6
|
* Issue 213: Search for clock_gettime in librtTrond Norbye2011-08-081-0/+4
|
* Issue 115: accont for CAS in item_size_okTrond Norbye2011-08-081-2/+7
|
* Fix incredibly slim race for maxconns handlerdormando2011-07-301-2/+2
| | | | | | | | | | I am an idiot: inbetween setting allow_new_conns -> false and calling the maxconns subroutine, another thread could have already flipped it back. This is probably due to a lack of strict memory barriers allowing the assignments to the allow_new_conns variable to be reordered outside of the lock. Instead of copy/pasting the handler enabler code, we now treat an fd argument of -42 as special and force the callback to run once. Normally fd is -1 since there's no associated socket for the callback.
* Fix whitespace bug in configure.acTrond Norbye2011-07-181-2/+2
|
* Issue 183 - Reclaim items dead by flush_allTrond Norbye2011-07-182-1/+26
|
* Issue 200: Don't fire dtrace probe as the last thing in a functionTrond Norbye2011-07-181-2/+1
| | | | | Some compilers (at least gcc 4.6.1) may optimize away the code when using certain optimization levels
* Gcc on Solaris sparc wants -R and not -rpath1.4.6Trond Norbye2011-07-151-4/+5
|
* Issue 121: Set the runtime path when --with-libevent is usedTrond Norbye2011-07-131-0/+4
| | | | | | Without a runtime path we're failing to run the programs we're building as part of configure, and memcached won't find the library during startup.
* Resolve issue 116 - remove obsolete thread documentationPaul Lindner2011-07-121-68/+0
|
* Fix autogen failure when unable to find supported command.nirvanazc2011-07-121-0/+5
| | | | Closing issue 190
* shed some dead udp_port code1.4.6-rc1dormando2011-07-121-3/+0
|
* Revert "Fix incorrect udp_port bind selection."dormando2011-07-121-2/+2
| | | | | | Patch was incorrect; it wired in some dead code which broke tests. Starting memcached with -p 11212 -U 0 should disable UDP, but with this patch -U 0 means "use the tcp port".
* fix race crash for accepting new connectionsdormando2011-07-121-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inspired by a patch by Kazuki Ohta. Summary from a mail sent to the list by Shigeki: [Example Scenario] 1. throw alot clients (well over connection limit) to connect to memcached. 2. memcached's file descriptors reaches maximum setting 3. main thread calls accept_new_conns(false) to stop polling sfd 4. main thread's event_base_loop stops accepting incoming request 5. main thread stops to acceess main_base at this point 6. a client disconnects 7. worker thread calls accept_new_conns(true) to start polling sfd 8. accept_new_conns uses mutex to protect main_base's race condition 9. worker thread starts loop with listen_conn 10. worker thread calls update_event with first conn 11. after first update_event(), main thread start polling sfd and starts to access main_base <- PROBLEM 12. Worker thread continues to call update_event() with second conn At this point, worker thread and main thread both acccess and modify main_base. --- The original patch coupled polling with the once-per-second clock timer. My patch creates a 10ms poller which kicks off after the listener is disabled. Switching for a conditional would be too much rewiring for 1.4, as 1.6 solves this in a better way.
* must reallocate in incr/decr if item in usedormando2011-07-111-1/+1
| | | | | lost this earlier somehow. if item is in flight, don't overwrite it in place during add_delta.