| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
easy win without restructuring item_alloc more: push the lock down after it's
done fiddling with snprintf.
|
|
|
|
| |
push cache_lock deeper into the abyss
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
been hard to measure while using the intel hash (since it's very fast), but
should help with the software hash.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
after the doublefork was added, the pidfile was now of the intermediary pid,
not the one forked after setsid.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
4 billion evictions should be enough for anybody!
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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).
|
|
|
|
|
| |
without setting write_and_go, multiple commands in one packet weren't always
being processed.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
Not doing GAT for now since I'd have to iterate through gat/gats/multigat/etc.
If there's demand, we can add it.
|
| |
|
|
|
|
|
|
|
|
| |
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 :)
|
|
|
|
|
| |
Taken from the 1.6 branch, partly written by Trond. I hope the CAS handling is
correct.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Dustin's set clock stuff would be nice :P
|
|
|
|
|
| |
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.
|
|
|
|
| |
previously hardcoded to 40. now will iterate up through all of them.
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
now fetches all the git files with the proper exemptions.
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
| |
Some compilers (at least gcc 4.6.1) may optimize away the code
when using certain optimization levels
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Closing issue 190
|
| |
|
|
|
|
|
|
| |
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".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
lost this earlier somehow. if item is in flight, don't overwrite it in
place during add_delta.
|