<div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">The default connection timeout in pecl/memcache is 1 second, and when<br>using Memcache::addServer() the connection isn&#39;t established until the
<br>first command is sent (ie. the &quot;get&quot; in your example). Perhaps you have<br>added several servers, one of which is unreachable, and thus the client<br>will stall 1 second before flagging that server as down and trying the
<br>next one. If you&#39;re using persistent connections, that server will still<br>be flagged as down on subsequent requests and will be skipped immediately.</blockquote></div>
<div>&nbsp;</div>
<div>Found the culprit!&nbsp; One of the memcache servers was bad.</div>
<div>&nbsp;</div>
<div><br>&nbsp;</div>
<div><span class="gmail_quote">On 10/27/07, <b class="gmail_sendername">Mikael Johansson</b> &lt;<a href="mailto:mikael@synd.info">mikael@synd.info</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi,<br><br>The default connection timeout in pecl/memcache is 1 second, and when<br>using Memcache::addServer() the connection isn&#39;t established until the
<br>first command is sent (ie. the &quot;get&quot; in your example). Perhaps you have<br>added several servers, one of which is unreachable, and thus the client<br>will stall 1 second before flagging that server as down and trying the
<br>next one. If you&#39;re using persistent connections, that server will still<br>be flagged as down on subsequent requests and will be skipped immediately.<br><br>Or as Marc said, the client might indeed be waiting for a DNS response..
<br><br>//Mikael<br><br>K J wrote:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; The slowdown is almost certainly in your client library. The server, on<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; our systems, takes about 1.5 milliseconds to start up, and a<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; fraction of<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; a millisecond to answer the first request. But your client might be
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; doing a lot of work the first time it executes. You didn&#39;t say what your<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; client language and environment is, so it&#39;s kind of hard to even take a<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; useful guess.<br>&gt;<br>&gt;<br>
&gt; The app is running on PHP and is using the PHP memcache library:<br>&gt; <a href="http://cn2.php.net/manual/en/ref.memcache.php">http://cn2.php.net/manual/en/ref.memcache.php</a><br>&gt;<br>&gt; I record the time it takes to render a page, and every page ends up
<br>&gt; taking 1 second or so.&nbsp;&nbsp;Most of that 1 second is due to the very first<br>&gt; memcache get request.&nbsp;&nbsp;It happens at every page that uses memcache.&nbsp;&nbsp;The<br>&gt; only time this problem goes away is when I run a load testing tool and
<br>&gt; start having multiple users hit the system constantly.<br>&gt;<br>&gt;<br>&gt;<br>&gt;<br>&gt; On 10/27/07, *Steven Grimm* &lt;<a href="mailto:sgrimm@facebook.com">sgrimm@facebook.com</a><br>&gt; &lt;mailto:<a href="mailto:sgrimm@facebook.com">
sgrimm@facebook.com</a>&gt;&gt; wrote:<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; K J wrote:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; So it&#39;s normal to have Memcache&#39;s response time be 1 second, if the<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; system is relatively idle?&nbsp;&nbsp;This happens when I&#39;m basically the only
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; user on the system, logging in, checking pages, etc.<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; The slowdown is almost certainly in your client library. The server, on<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; our systems, takes about 1.5 milliseconds to start up, and a fraction of
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; a millisecond to answer the first request. But your client might be<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; doing a lot of work the first time it executes. You didn&#39;t say what your<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; client language and environment is, so it&#39;s kind of hard to even take a
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; useful guess.<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; -Steve<br>&gt;<br>&gt;<br><br><br></blockquote></div><br>