Re: Failed reading line from stream (0): over 1'000'000 pages on google and no fix?

2011-06-28 Thread dormando
http://code.google.com/p/memcached/wiki/Timeouts <-- run through this.

You can also try to get the key in question from your error, then fetch
the key manually and inspect it to see if the data is corrupt.

On Tue, 28 Jun 2011, kfa1983 wrote:

> Yea, I think the server is timing out but WHY? xD the port is open.
> But the problem is actually the memcache or the code? Thanks!
>
> On 28 juin, 19:26, dormando  wrote:
> > > In the logs:
> > > Notice:  Memcache::get() [memcache.get]:
> > > Server localhost (tcp 11211) failed with: Failed reading line from
> > > stream (0) in /var/www/html/inc/chat/libraries/server/NodeJS.php > > b> on line 37
> > > {"r":"registered"}
> >
> > > At line 37:
> > > $session = json_decode($this->memcache->get('session/' . $cookie-
> > > >sid));
> >
> > I hate that client...
> >
> > That's either a timeout, or a corrupt key?
>


Re: Failed reading line from stream (0): over 1'000'000 pages on google and no fix?

2011-06-28 Thread kfa1983
Yea, I think the server is timing out but WHY? xD the port is open.
But the problem is actually the memcache or the code? Thanks!

On 28 juin, 19:26, dormando  wrote:
> > In the logs:
> > Notice:  Memcache::get() [memcache.get]:
> > Server localhost (tcp 11211) failed with: Failed reading line from
> > stream (0) in /var/www/html/inc/chat/libraries/server/NodeJS.php > b> on line 37
> > {"r":"registered"}
>
> > At line 37:
> > $session = json_decode($this->memcache->get('session/' . $cookie-
> > >sid));
>
> I hate that client...
>
> That's either a timeout, or a corrupt key?


Invitation to connect on LinkedIn

2011-06-28 Thread Peter Pang
LinkedIn


   
I'd like to add you to my professional network on LinkedIn.

- Peter

Peter Pang
senior software engineer at Baidu, Inc. 
Melbourne Area, Australia

Confirm that you know Peter Pang
https://www.linkedin.com/e/-8vvkjb-gphs0amk-2s/isd/3375612604/0rGRLJBa/


 
-- 
(c) 2011, LinkedIn Corporation

Memcached "get_or_lock" and defer "delete" functions Proposal

2011-06-28 Thread Wenlin
Memcached "get_or_lock" and defer "delete" functions Proposal

ABSTRACT

On busiest web sites who depend on memcache technology, when cache
expired or deleted, they should face database query flood. This is the
Concurrent-Cache-Miss-Renew problem. This proposal provide a Defer-
Expiration mechanism to solve the problem.

This proposal also recall the defer "delete" function back to solve
frequent delete problem.

MOTIVATION
--
On our web site, always we use following piece code to acting with
memcache:


$val = $memcache->get($key);
if (!$val) {
$val = $db->query($sql);
$memcache->set($key, $val, $expire);
}


If $sql is large time consumed, then when cache expired on high visits
period, we should face database load too high problem.

Why? Because $sql is complicate, then the database query should need a
bit long time. Before the database query complete, there should be a
lot of concurrent requests got cache-miss and do same cache-renew
process. Too many concurrent and complicate $sql query should slow-
down the database execution and let more requests fall in cache-miss
and cache-renew hell. This is a positive feedback until the cache be
renewed lastly.

In our practice, this problem led our site unstable on high visits
period randomly. And, when it happens, always need several seconds to
get back stable.

About defer `delete` function, when we frequent update database and
delete cache entry (e.g., delete entry 20 times in 1 second), we will
got lots cache-miss and enhanced the above (Concurrent-Cache-Miss-
Renew) problem.

SOLUTION

We patched memcached to add "get_or_lock" instruction to provide Defer-
Expiration function. Sample code first:


$val = $memcache->getOrLock($key);
if (!$val) {
$val = $db->query($sql);
$memcache->set($key, $val, $expire);
}


When use "get_or_lock" and cache-hit, no different behaviour with
current memcached's "get" implements. But when cache-miss, and expired
less than specific defer-expire time, e.g. 3 seconds (configable),
then first two "get_or_lock" requests will got cache-miss and others
got the staled value per second. When cache expired eq or above 3
seconds, the behaviour becames same as classic "get" again. That's
all.

Where the "get_or_lock"'s behaviour is unacceptable, we can simply
switch back to use "get". No comflicts with each other.

About defer `delete` function, Sample code first too:


$memcache->delete($key, $hold);


This is only recalled the deprecated memcached function but use
reliable and consist expire model the "get_or_lock" enforced.

Please note, on memcached text protocol, "get_or_lock"'s command is
'lget', 'lgets', etc. On binary protocol, I use
PROTOCOL_BINARY_CMD_LOCKBIT (0x80) to indicates locked version 'get',
'gets' and 'getk'.

CONCLUSION
--
We use "get_or_lock" combine with defer "delete" gains performace and
stablity on our site on high visits period. Adopt these modifications
makes our site's HTTP 502 statistics down from 12000~14000 to 50~100
per week.


Re: Memcached "get_or_lock" and defer "delete" functions Proposal

2011-06-28 Thread Sopl'Wang
I've upload my patch:
http://soplwang.com/my-file/memcached-1.4.5-get_or_lock.zip

hope it's useful.

regards,
soplwang

2011/6/29 Wenlin 

> Memcached "get_or_lock" and defer "delete" functions Proposal
>
> ABSTRACT
> 
> On busiest web sites who depend on memcache technology, when cache
> expired or deleted, they should face database query flood. This is the
> Concurrent-Cache-Miss-Renew problem. This proposal provide a Defer-
> Expiration mechanism to solve the problem.
>
> This proposal also recall the defer "delete" function back to solve
> frequent delete problem.
>
> MOTIVATION
> --
> On our web site, always we use following piece code to acting with
> memcache:
>
> 
> $val = $memcache->get($key);
> if (!$val) {
>$val = $db->query($sql);
>$memcache->set($key, $val, $expire);
> }
> 
>
> If $sql is large time consumed, then when cache expired on high visits
> period, we should face database load too high problem.
>
> Why? Because $sql is complicate, then the database query should need a
> bit long time. Before the database query complete, there should be a
> lot of concurrent requests got cache-miss and do same cache-renew
> process. Too many concurrent and complicate $sql query should slow-
> down the database execution and let more requests fall in cache-miss
> and cache-renew hell. This is a positive feedback until the cache be
> renewed lastly.
>
> In our practice, this problem led our site unstable on high visits
> period randomly. And, when it happens, always need several seconds to
> get back stable.
>
> About defer `delete` function, when we frequent update database and
> delete cache entry (e.g., delete entry 20 times in 1 second), we will
> got lots cache-miss and enhanced the above (Concurrent-Cache-Miss-
> Renew) problem.
>
> SOLUTION
> 
> We patched memcached to add "get_or_lock" instruction to provide Defer-
> Expiration function. Sample code first:
>
> 
> $val = $memcache->getOrLock($key);
> if (!$val) {
>$val = $db->query($sql);
>$memcache->set($key, $val, $expire);
> }
> 
>
> When use "get_or_lock" and cache-hit, no different behaviour with
> current memcached's "get" implements. But when cache-miss, and expired
> less than specific defer-expire time, e.g. 3 seconds (configable),
> then first two "get_or_lock" requests will got cache-miss and others
> got the staled value per second. When cache expired eq or above 3
> seconds, the behaviour becames same as classic "get" again. That's
> all.
>
> Where the "get_or_lock"'s behaviour is unacceptable, we can simply
> switch back to use "get". No comflicts with each other.
>
> About defer `delete` function, Sample code first too:
>
> 
> $memcache->delete($key, $hold);
> 
>
> This is only recalled the deprecated memcached function but use
> reliable and consist expire model the "get_or_lock" enforced.
>
> Please note, on memcached text protocol, "get_or_lock"'s command is
> 'lget', 'lgets', etc. On binary protocol, I use
> PROTOCOL_BINARY_CMD_LOCKBIT (0x80) to indicates locked version 'get',
> 'gets' and 'getk'.
>
> CONCLUSION
> --
> We use "get_or_lock" combine with defer "delete" gains performace and
> stablity on our site on high visits period. Adopt these modifications
> makes our site's HTTP 502 statistics down from 12000~14000 to 50~100
> per week.
>


Re: Failed reading line from stream (0): over 1'000'000 pages on google and no fix?

2011-06-28 Thread dormando
> In the logs:
> Notice:  Memcache::get() [memcache.get]:
> Server localhost (tcp 11211) failed with: Failed reading line from
> stream (0) in /var/www/html/inc/chat/libraries/server/NodeJS.php b> on line 37
> {"r":"registered"}
>
> At line 37:
> $session = json_decode($this->memcache->get('session/' . $cookie-
> >sid));

I hate that client...

That's either a timeout, or a corrupt key?


Re: Issue 209 in memcached: ¿could we reset stats counters when i flushes memcacheds?

2011-06-28 Thread memcached

Updates:
Status: WontFix

Comment #1 on issue 209 by dorma...@rydia.net: ¿could we reset stats  
counters when i flushes memcacheds?

http://code.google.com/p/memcached/issues/detail?id=209

flush_all is lazy and does not free up any memory. items would be removed  
as they are fetched, and found to have been flushed.




Re: problem with compiling 1.6 beta on Windows

2011-06-28 Thread Trond Norbye
From a clean repo with:

make -f win32/Makefile.mingw

Cheers,

Trond


On 28. juni 2011, at 09.58, Rafal Likus wrote:

> Ok, I downloaded latest MSysGit, and MinGW, both gives the same
> result.
> I downloaded official beta and latest snapshot of Memcached.
> Copied m4/version.m4 from official beta to snapshot.
> And:
> ./config/autorun.sh  - works OK - this not works in official beta.
> ./configure  - works OK.
> make - gives errors.
> The most strange for me is
> gcc.exe: unrecognized option '-pthread'
> 
> pthreads dlls and header files are in bin and lib directories.
> 
> What am I doing wrong?
> Nobody builds on Windows except Core Team - how do You do this?
> 
> Maybe I should build MinGW from scratch?
> 
> Can you help? I will be glad if I could test this version.
> 
> Full dump from make:
> 
> $ make
> make  all-am
> make[1]: Entering directory `/c/Temp/memcached-16b7'
> /bin/sh ./libtool  --tag=CC   --mode=compile gcc -std=gnu99 -
> DHAVE_CONFIG_H -I. -I./include -I./libevent  -I./utilities -I./include
> -I./libevent   -fvisibility=hidden -pthread -g -O2 -Wall -Werror -
> pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
> -MT libmemcached_utilities_la-engine_loader.lo -MD -MP -MF .deps/
> libmemcached_utilities_la-engine_loader.Tpo -c -o
> libmemcached_utilities_la-engine_loader.lo `test -f 'utilities/
> engine_loader.c' || echo './'`utilities/engine_loader.c
> libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I./include -I./
> libevent -I./utilities -I./include -I./libevent -fvisibility=hidden -
> pthread -g -O2 -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-
> declarations -Wredundant-decls -MT libmemcached_utilities_la-
> engine_loader.lo -MD -MP -MF .deps/libmemcached_utilities_la-
> engine_loader.Tpo -c utilities/engine_loader.c  -DDLL_EXPORT -DPIC -
> o  .libs/libmemcached_utilities_la-engine_loader.o
> gcc.exe: unrecognized option '-pthread'
> cc1.exe: warnings being treated as errors
> utilities/engine_loader.c: In function 'load_engine':
> utilities/engine_loader.c:32: error: implicit declaration of function
> 'dlopen'
> utilities/engine_loader.c:32: error: 'RTLD_NOW' undeclared (first use
> in this function)
> utilities/engine_loader.c:32: error: (Each undeclared identifier is
> reported only once
> utilities/engine_loader.c:32: error: for each function it appears in.)
> utilities/engine_loader.c:32: error: 'RTLD_LOCAL' undeclared (first
> use in this function)
> utilities/engine_loader.c:32: error: assignment makes pointer from
> integer without a cast
> utilities/engine_loader.c:34: error: implicit declaration of function
> 'dlerror'
> utilities/engine_loader.c:34: error: initialization makes pointer from
> integer without a cast
> utilities/engine_loader.c:42: error: implicit declaration of function
> 'dlsym'
> utilities/engine_loader.c:42: error: initialization makes pointer from
> integer without a cast
> utilities/engine_loader.c:58: error: implicit declaration of function
> 'dlclose'
> make[1]: *** [libmemcached_utilities_la-engine_loader.lo] Error 1
> make[1]: Leaving directory `/c/Temp/memcached-16b7'
> make: *** [all] Error 2
> 
> 
> 
> --
> Regards
> Rafal



Is Memcatched will support nearcache and local cache?

2011-06-28 Thread Anand
Is Memcatched will support nearcache and local cache? Please explain.
How i can override the cache configuration? Please explain with
example.

Thanks & Regards
AnanthaRamu Bose


Failed reading line from stream (0): over 1'000'000 pages on google and no fix?

2011-06-28 Thread kfa1983
Hi guys,

Ok, I have a problem with the memcache.get, I've been on it for 2 days
and it's still there...

In the logs:
Notice:  Memcache::get() [memcache.get]:
Server localhost (tcp 11211) failed with: Failed reading line from
stream (0) in /var/www/html/inc/chat/libraries/server/NodeJS.php on line 37
{"r":"registered"}

At line 37:
$session = json_decode($this->memcache->get('session/' . $cookie-
>sid));

Any idea?

Thanks!


Re: problem with compiling 1.6 beta on Windows

2011-06-28 Thread Rafal Likus
Ok, I downloaded latest MSysGit, and MinGW, both gives the same
result.
I downloaded official beta and latest snapshot of Memcached.
Copied m4/version.m4 from official beta to snapshot.
And:
./config/autorun.sh  - works OK - this not works in official beta.
./configure  - works OK.
make - gives errors.
The most strange for me is
gcc.exe: unrecognized option '-pthread'

pthreads dlls and header files are in bin and lib directories.

What am I doing wrong?
Nobody builds on Windows except Core Team - how do You do this?

Maybe I should build MinGW from scratch?

Can you help? I will be glad if I could test this version.

Full dump from make:

$ make
make  all-am
make[1]: Entering directory `/c/Temp/memcached-16b7'
/bin/sh ./libtool  --tag=CC   --mode=compile gcc -std=gnu99 -
DHAVE_CONFIG_H -I. -I./include -I./libevent  -I./utilities -I./include
-I./libevent   -fvisibility=hidden -pthread -g -O2 -Wall -Werror -
pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
-MT libmemcached_utilities_la-engine_loader.lo -MD -MP -MF .deps/
libmemcached_utilities_la-engine_loader.Tpo -c -o
libmemcached_utilities_la-engine_loader.lo `test -f 'utilities/
engine_loader.c' || echo './'`utilities/engine_loader.c
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I./include -I./
libevent -I./utilities -I./include -I./libevent -fvisibility=hidden -
pthread -g -O2 -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-
declarations -Wredundant-decls -MT libmemcached_utilities_la-
engine_loader.lo -MD -MP -MF .deps/libmemcached_utilities_la-
engine_loader.Tpo -c utilities/engine_loader.c  -DDLL_EXPORT -DPIC -
o  .libs/libmemcached_utilities_la-engine_loader.o
gcc.exe: unrecognized option '-pthread'
cc1.exe: warnings being treated as errors
utilities/engine_loader.c: In function 'load_engine':
utilities/engine_loader.c:32: error: implicit declaration of function
'dlopen'
utilities/engine_loader.c:32: error: 'RTLD_NOW' undeclared (first use
in this function)
utilities/engine_loader.c:32: error: (Each undeclared identifier is
reported only once
utilities/engine_loader.c:32: error: for each function it appears in.)
utilities/engine_loader.c:32: error: 'RTLD_LOCAL' undeclared (first
use in this function)
utilities/engine_loader.c:32: error: assignment makes pointer from
integer without a cast
utilities/engine_loader.c:34: error: implicit declaration of function
'dlerror'
utilities/engine_loader.c:34: error: initialization makes pointer from
integer without a cast
utilities/engine_loader.c:42: error: implicit declaration of function
'dlsym'
utilities/engine_loader.c:42: error: initialization makes pointer from
integer without a cast
utilities/engine_loader.c:58: error: implicit declaration of function
'dlclose'
make[1]: *** [libmemcached_utilities_la-engine_loader.lo] Error 1
make[1]: Leaving directory `/c/Temp/memcached-16b7'
make: *** [all] Error 2



--
Regards
Rafal


Issue 209 in memcached: ¿could we reset stats counters when i flushes memcacheds?

2011-06-28 Thread memcached

Status: New
Owner: 
Labels: Type-Defect Priority-Medium

New issue 209 by marc.cor...@gmail.com: ¿could we reset stats counters when  
i flushes memcacheds?

http://code.google.com/p/memcached/issues/detail?id=209

What steps will reproduce the problem?
1. When i've launched "flush_all" to instance's socket.


What is the expected output? What do you see instead?
Counters curr_items/total_items would be reset

What version of the product are you using? On what operating system?
memcached-1.4.5-1 in Red Hat Enterprise Linux Server release 5.6 (Tikanga)

Please provide any additional information below.





Re: Memcached installation issue.

2011-06-28 Thread Roberto Spadim
http://pecl.php.net/package/memcached
http://pecl.php.net/package/memcache

if you are using memcached, i think here is the right place, since it
use libmemcached


2011/6/28 Chetan Gadgilwar :
> My server is running but havent talk to memcache pecl extension guys, where
> i can post my issue any link?
>
>
> On Mon, Jun 27, 2011 at 11:40 PM, Roberto Spadim 
> wrote:
>>
>> maybe you server isn´t running, did you tried to talk with memcache pecl
>> extension guys?
>> did you tried memcached extension too?
>>
>> 2011/6/27 Chetan Gadgilwar 
>>>
>>> Hi Guys,
>>>
>>> I solved an installation issue by replacing a compatible .dll extension.
>>>
>>> I am running a following piece of code on my localhost
>>>
>>> >> /* OO API */
>>> $memcache_obj = new Memcache;
>>> $memcache_obj->connect('127.0.0.1', 11211) or die ("Could not connect");
>>> $memcache_obj->set('any_key', 'some value', 60);
>>> echo $memcache_obj->get('any_key');
>>> ?>
>>>
>>>
>>> But its not working, showing "Could not connect".
>>> Any idea?
>>>
>>> On Mon, Jun 27, 2011 at 9:57 PM, Chetan Gadgilwar 
>>> wrote:

 I am new with memcached.

 I am trying to install a memcached on my local machine which is windows
 vista.
 Apache version is 2.2.11 & php version is 5.3.0

 I used this link for installation

 http://pureform.wordpress.com/2008/01/10/installing-memcache-on-windows-for-php/#respond

 But still i am getting Fatal error: Class 'Memcache' not found

 I check an apache error logs & i found


 Warning:  PHP Startup: memcache: Unable to initialize module
 Module compiled with module API=20060613
 PHP    compiled with module API=20090626


 I think my php_memcache.dll is not compatible, which is downloaded from
 http://blog.eood.cn/windows-php-memcache-dll-download

 i am not able to figure out whats the problem exactly.

 Is any idea why its happening, please suggest me & help me out because
 its only a starting point to memcahced.

 --
  Best wishes,
 Chetan Gadgilwar
>>>
>>>
>>>
>>> --
>>>  Best wishes,
>>> Chetan Gadgilwar
>>
>>
>>
>> --
>> Roberto Spadim
>> Spadim Technology / SPAEmpresarial
>
>
>
> --
>  Best wishes,
> Chetan Gadgilwar
>



-- 
Roberto Spadim
Spadim Technology / SPAEmpresarial


Re: Issue 208 in memcached: Is Memcatched will support nearcache and local cache? Please explain.

2011-06-28 Thread memcached

Updates:
Status: Invalid

Comment #1 on issue 208 by trond.no...@gmail.com: Is Memcatched will  
support nearcache and local cache? Please explain.

http://code.google.com/p/memcached/issues/detail?id=208

Please don't use the issue tracker to ask questions. use the mailing list  
for that




Issue 208 in memcached: Is Memcatched will support nearcache and local cache? Please explain.

2011-06-28 Thread memcached

Status: New
Owner: 
Labels: Type-Defect Priority-Medium

New issue 208 by rainbowa...@gmail.com: Is Memcatched will support  
nearcache and local cache? Please explain.

http://code.google.com/p/memcached/issues/detail?id=208

Is Memcatched will support nearcache and local cache? Please explain.