Opened 10 years ago

Last modified 9 years ago

#237 new defect

xcache_get() takes out write lock

Reported by: Aryeh Gregor Owned by: moo
Priority: minor Milestone: 5.0.0
Component: cacher Version: 1.2.2
Keywords: Cc:
Application: PHP Version: PHP 5.2.6-2ubuntu4.5
Other Exts: SAPI: Irrelevant
Probability: Always Blocked By:


If I try xcache_get()ing a very large array (assigning it to a variable causes PHP's memory usage to rise by ~50M), from a lot of different threads at once, performance drops like a stone. Debugger <> shows lots of processes stuck in xc_fcntl_lock().

If I serialize() the array to a string and store the string rather than an array, there are no locking problems that I notice even with lots of requests, but the xcache_get()+unserialize() of the string takes a lot longer (on a single thread) than xcache_get() of the array.

I looked at the source code and it seems that even xcache_get() is taking out write locks. Could it maybe be modified to take out read locks instead, so there's no lock contention? The variable is practically never changed, in my case. I imagine problems would arise if you were reading smaller variables often enough, too.

I asked on IRC and icy suggested I file a ticket.

Change History (1)

comment:1 Changed 9 years ago by moo

  • Milestone changed from 1.3.2 to 2.0.0
Note: See TracTickets for help on using tickets.