Re: feature request : easy shared memory

From: Date: Thu, 14 Mar 2013 16:13:58 +0000
Subject: Re: feature request : easy shared memory
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Am 14.3.2013 um 16:46 schrieb Lazare Inepologlou <[email protected]>:

> Hello,
> 
> 2013/3/14 rene7705 <[email protected]>
> 
>> great! :)
>> 
>> this will do nicely. is there much overhead for storing and fetching these
>> variables? (ideally I would like to get a pointer)
>> 
>> 
> Unfortunately there is. Every object stored in APC has to be serialised
> first and then unserialised on retrieval. You can improve performance by
> using a binary serialiser (such as igBinary) instead of the default php one.
> 
> 
> 
> 
>> 
>> On Thu, Mar 14, 2013 at 12:45 PM, Nikita Nefedov <[email protected]>
>> wrote:
>> 
>>> On Thu, 14 Mar 2013 07:05:03 -0000, rene7705 <[email protected]> wrote:
>>> 
>>> Hi.
>>>> 
>>>> I'd like to build a replacement for SQL (yes, talk about an ambitious
>>>> project! ;), because the constant transferal of data in and out of SQL
>>>> from
>>>> Javascript (where everything might as well be object-oriented and
>>>> hierarchial) is a pain in the neck.
>>>> 
>>>> But in order to do so, I'd very much like PHP (the server still controls
>>>> the data after all) to support shared memory efficiently.
>>>> 
>>>> Something like
>>>> 
>>>> sharedmem $bigNestedArray; // $bigNestedArray would be shared accross
>> the
>>>> entire server and all CPUs on it.
>>>> 
>>>> as you now have
>>>> 
>>>> global $bigNestedArray;
>>>> 
>>>> would be ideal.
>>>> 
>>>> I bet this would be useful for a host of other applications as well, and
>>>> fairly easy to implement.
>>>> 
>>>> I'm an application programmer by trade, or I would hack this in myself.
>>>> 
>>>> I'd much rather see the PHP development team develop this in properly. I
>>>> don't think it would require much time, as OS-level shared memory has
>> been
>>>> easy to implement since the 1990s.
>>>> 
>>>> Please put this on the agenda, and get back to us in this thread as to
>>>> when
>>>> this will be available.
>>>> 
>>> 
>>> Hi,
>>> 
>>> You can already do it using APC's apc_store() and apc_fetch() functions
>>> which let you use shared memory. But of course you should 'commit' every
>>> change of the fetched variable.
>>> 
>> 
> 
> 
> Lazare INEPOLOGLOU
> Ingénieur Logiciel

Hi!

And there is no possibility to store the zval as raw binary data like in memory (deep copy?)
So that you only have to copy from ram? And replace the pointers to the place in the string?
This must be possible I think. And should be faster.

shmop has to be opened on every request and only supports strings.
APC, memcache,... can only save under serialized form which is slow.

Why not integrate some native shared memory mechanism which is faster than the extensions
which always serialize? (or as a new extension… but I really like the proposal to do like
"shared $var;" which is (nearly) impossible as an extension)

Bob Weinand


Thread (11 messages)

« previous php.internals (#66617) next »