Re: Re: shared memory on php servers?
| From: | Stuart Dallas | Date: | Tue, 04 Dec 2012 11:04:57 +0000 |
| Subject: | Re: Re: shared memory on php servers? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-319783@lists.php.net to get a copy of this message | ||
On 4 Dec 2012, at 10:51, rene7705 <rene7705@gmail.com> wrote:
> I would also like to hear any thoughts on how to efficiently add,
> delete and edit data in this large and deep array structure from
> multiple sessions at nearly the same time..
>
> On Tue, Dec 4, 2012 at 11:49 AM, rene7705 <rene7705@gmail.com> wrote:
>> Hi folks..
>>
>> I'm wondering, what's the fastest way to put a large and deep array()
>> structure in shared memory on a PHP server?
Split the data up into smaller pieces. There's rarely a valid reason to store a huge array of
data as a single blob. It's an array, so it breaks up by the first level of keys at the very
least.
Look at APC, memcached, and redis. These are the most popular ways to store data in shared memory.
Note that APC is a PHP extension so you can only access the shared memory from one machine, whereas
memcached and redis are separate daemons so you can access them from multiple servers.
Also, as Sebastian says, a database is another option unless you have a good reason to want the data
in shared memory rather than a DB.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/