Problem with memcache - help needed

Problem with memcache - help needed

am 14.08.2009 13:14:15 von Jean Michel Malatray

Hello folk!

Currently, we use memcached as caching solution.

We provide a link to 3 servers, a server-2x the Memcache daemon is started
(2 different ports (depending 4GB)

192.168.0.1:11211 (4 GB)

192.168.0.1:11212 (4 GB)

192.168.0.2:11211 (700 MB)

192.168.0.3:11211 (700 MB)

-> Php.ini: memcache.hash_strategy consistent = <--

$o_memcache = new Memcache ();

$o_memcache->addServer ([SERVER], [PORT]);

whenever a request comes the "connect" is no longer needed because Memcache
established the connection automatically.

We also tried $o_memcache=connect([SERVER], [PORT]); - same problem.

About $o_memcache->get([KEY]), we check to see if the KEY is already set
(KEY = UNIQUE!).

In case of error returns GET "false".

When TRUE, the content of the KEY will be shown - otherwise with
$o_memcache->set([KEY], [CONTENT], MEMCACHE_COMPRESSED, mktime (date ( "H")
+6)); will be saved for 6 hours.

You should guess the KEY will be saved for the next 6 hours, but in this
case, it will not.

After about 2-3 minutes the KEY returns with GET "FALSE" again.

?

We also tried this:

- Memcache connection with addServer, connect and pconnect

- 1 server as connection, multiple server (like listed above - as pool)

?

Server stats:

evictions = 0

cur_connections: ~50-100

?

Server settings:

Apache 2.11

PHP 5.2.8

Memcache-Info by phpinfo();

Active persistent connections 4

Version 2.2.5

Revision $Revision: 1.111 $

memcache.allow_failover 1 1

memcache.chunk_size 8192 8192

memcache.default_port 11211 11211

memcache.default_timeout_ms 1000 1000

memcache.hash_function crc32 crc32

memcache.hash_strategy consistent consistent memcache.max_failover_attempts
20 20

?

Does anybody know this issue or solution(s) to fix this problem?

Thanks for help.

Jean Michel



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Problem with memcache - help needed

am 14.08.2009 15:06:06 von Eddie Drapkin

On Fri, Aug 14, 2009 at 7:14 AM, Jean Michel
Malatray wrote:
> Hello folk!
>
> Currently, we use memcached as caching solution.
>
> We provide a link to 3 servers, a server-2x the Memcache daemon is started
> (2 different ports (depending 4GB)
>
> 192.168.0.1:11211 (4 GB)
>
> 192.168.0.1:11212 (4 GB)
>
> 192.168.0.2:11211 (700 MB)
>
> 192.168.0.3:11211 (700 MB)
>
> -> Php.ini: memcache.hash_strategy consistent = <--
>
> $o_memcache = new Memcache ();
>
> $o_memcache->addServer ([SERVER], [PORT]);
>
> whenever a request comes the "connect" is no longer needed because Memcache
> established the connection automatically.
>
> We also tried $o_memcache=connect([SERVER], [PORT]); - same problem.
>
> About $o_memcache->get([KEY]), we check to see if the KEY is already set
> (KEY = UNIQUE!).
>
> In case of error returns GET "false".
>
> When TRUE, the content of the KEY will be shown - otherwise with
> $o_memcache->set([KEY], [CONTENT], MEMCACHE_COMPRESSED, mktime (date ( "H")
> +6)); will be saved for 6 hours.
>
> You should guess the KEY will be saved for the next 6 hours, but in this
> case, it will not.
>
> After about 2-3 minutes the KEY returns with GET "FALSE" again.
>
> ?
>
> We also tried this:
>
> - Memcache connection with addServer, connect and pconnect
>
> - 1 server as connection, multiple server (like listed above - as pool)
>
> ?
>
> Server stats:
>
> evictions = 0
>
> cur_connections: ~50-100
>
> ?
>
> Server settings:
>
> Apache 2.11
>
> PHP 5.2.8
>
> Memcache-Info by phpinfo();
>
> Active persistent connections 4
>
> Version 2.2.5
>
> Revision $Revision: 1.111 $
>
> memcache.allow_failover 1 1
>
> memcache.chunk_size 8192 8192
>
> memcache.default_port 11211 11211
>
> memcache.default_timeout_ms 1000 1000
>
> memcache.hash_function crc32 crc32
>
> memcache.hash_strategy consistent consistent memcache.max_failover_attempts
> 20 20
>
> ?
>
> Does anybody know this issue or solution(s) to fix this problem?
>
> Thanks for help.
>
> Jean Michel
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

A couple of things,
1) Use PECL/Memcached and not PECL/Memcache. It's faster, better
maintained, has more features, blah blah blah.
2) Set expects an integer number of seconds to keep it, mktime(date()
+ 6) is going to return an enormous number, which it looks like
memcache doesn't know how to handle. If you want to save something
for six hours, you need to set() with an integer value of 60*60*6
(seconds in a minute * minutes in an hour * 6 hours).

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php