|
Posted by Rasmus Lerdorf on 01/06/05 02:04
Richard Lynch wrote:
> Rasmus Lerdorf wrote:
>
>>Robert Cummings wrote:
>>
>>>FWIW, I can't see how a WYW server is going to make his application run
>>>faster. The transfer of the data he wants will still have to be
>>>serialized and unserialized (in an optimal WYW server only unserialized)
>>>and this is is exactly his bottleneck using an include. Actually I'd
>>>imagine because he's using an accelerator it's fast as it can get
>>>without using some kind of shared memory system. Correct me if I'm
>>>confused and you know how to transfer raw zend vars over a socket
>>>without the need to unserialize on the receiver end.
>>
>>You are correct, serialization tends to be the bottleneck when it comes
>>to restoring large data structs. So you either avoid recreating the
>>data structure and just use the data directly, or use an in-process
>>mechanism like apc_store/apc_fetch which does a straight memcpy and
>>doesn't need top serialize. Of course, this still doesn't match writing
>>your own extension to manage your persistent data directly without
>>needing to shuffle it around back and forth between process and shared
>>memory.
>
>
> Perhaps I'm just being naive and/or stupid, but I was imagining his array
> elements going in separate apc_store()s...
>
> And he'd not serialize them, cuz they're just INT or CHAR...
>
> So he'd only retrieve what he needed on a one-by-one basis, very quickly...
>
> But maybe that can't be done.
You can apc_store an entire PHP array in a single call and bring it back
out with a single apc_fetch call without any serialization needed. It
does however do a deep-copy, so there is still overhead, but it is an
order of magnitude faster than serialize/unserialize.
-Rasmus
Navigation:
[Reply to this message]
|