XCache: Ticket #237: xcache_get() takes out write lockhttp://xcache.lighttpd.net/ticket/237
<p>
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 &lt;<a class="ext-link" href="http://poormansprofiler.org/" rel="nofollow"><span class="icon">​</span>http://poormansprofiler.org/</a>&gt; shows lots of processes stuck in xc_fcntl_lock().
</p>
<p>
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.
</p>
<p>
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.
</p>
<p>
I asked on IRC and icy suggested I file a ticket.
</p>
en-usXCache/chrome/site/xcache.pnghttp://xcache.lighttpd.net/ticket/237
Trac 1.0.6.post2mooMon, 18 Apr 2011 06:59:17 GMTmilestone changedhttp://xcache.lighttpd.net/ticket/237#comment:1
http://xcache.lighttpd.net/ticket/237#comment:1
<ul>
<li><strong>milestone</strong>
changed from <em>1.3.2</em> to <em>2.0.0</em>
</li>
</ul>
Ticket