Survey on memcached

2011-11-02 Thread Gavin M. Roy
In influencing application architecture in internal discussions and
when discussing scalability at conferences, I often hear myself saying
many of the same things about memcached and wonder if my views are
reasonable. I know on list there are religious views as well about how
memcached should be used as well. This is a quick survey to help me
balance my views with common practice.

I am not affiliated with the memcached project, nor is the survey. It
also is not for any commercial purpose, I am just looking at this from
a pure engineering debate perspective.

I will publish the survey results after there are a reasonable amount
of respondents and follow up on this thread.

Survey link: https://www.surveymonkey.com/s/J9PFP8R

Thanks,

Gavin


Re: REST API

2010-07-28 Thread Gavin M. Roy
On Wed, Jul 28, 2010 at 11:37 AM, jsm  wrote:

> > What is the value-add you are looking from the RESTful version of the
> > memcached API?
>
> Basically to be able to use without binding to any particular
> language.
>

Not to push too hard on his, but the ascii protocol is simple and easy to
implement using sockets in any language:

http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt

I'd go as far as to say if you're focused on HTTP REST, it's a more simple
client implementation to just use the ascii protocol.  If you do go down the
route of implementing HTTP REST, you'll want to look at stuff like
libevent's HTTP server as well as something like libmicrohttpd.

Regards,

Gavin


Re: REST API

2010-07-28 Thread Gavin M. Roy
Why add the HTTP protocol overhead?  REST/HTTP would add ~75Mbps of
additional traffic at 100k gets per second by saying there's a rough 100
byte overhead per request over the ASCII protocol.  I base the 100 bytes by
the HTTP GET request, minimal request headers and minimal response
headers. The binary protocol is very terse in comparison to the ASCII
protocol.  In addition netcat or telnet works as good as curl for drop dead
simplicity.  Don't get me wrong, it would be neat, but shouldn't be
considered in moderately well used memcached environments.

Regards,

Gavin

On Wed, Jul 28, 2010 at 8:43 AM, jsm  wrote:

> Anyone writing or planning to write a REST API for memcached?
> If no such plan, I would be interested in writing a REST API.
> Any suggestions, comments welcome.
>


Re: stats help

2010-07-25 Thread Gavin M. Roy
I use RRDTool for this with derive counter types.  Collect the data you want
from the stats command and use rrdtool to store the data every minute, graph
it out with rrdtool graph and you'll get your trended stats.

On Sun, Jul 25, 2010 at 12:27 PM, Les Mikesell wrote:

> Dustin wrote:
>
>> On Jul 24, 10:39 pm, Spike  wrote:
>>
>>> hi, i am newbie to memcached. I need help in finding how to get
>>> throughput stat.
>>>
>>> I want to see how much throughput memcache is getting. "stats" command
>>> does not list any stat for through put (requests per sec). Any idea on
>>> how to go about getting that info? Does memcache keep track of this
>>> information?
>>>
>>
>>  It's rare to keep derived stats like that in general.  It's usually
>> not interesting.  Do you want average requests per second over the
>> lifetime of the process?  Over the last second?, 60 seconds? 300, 900,
>> 3600, etc...
>>
>>  Most of the time, this is easily observable from the outside.
>> Collect counters -- wait a bit, collect them again, then do your own
>> math.  That'll give you exactly what you want.
>>
>
> It's a bit off topic for this list, but does anyone know if there are good
> generic tools for that?  There are quite a few designed to convert SNMP
> 'COUNTER' types to rates, check thresholds and keep history to graph the
> trends, but usually the SNMP sampling is closely coupled to the rest of the
> logic.  I think OpenNMS might do it with values it can pick up with http
> requests but I'm not sure how well it handles the spikes that would appear
> from restarts and value rollovers.
>
> --
>  Les Mikesell
>   lesmikes...@gmail.com
>
>


Re: I get 'Could NOT connect to memcache server' sometimes even when server is up

2010-07-12 Thread Gavin M. Roy
What is your pageview velocity?  There's really no good reason you should be
seeing intermittent failure and having timeouts that high will impact your
pageload performance.

As was mentioned, if you're seeing behavior like this you ever have serious
network or server hardware/configuration issues independent of memcached.

On Mon, Jul 12, 2010 at 2:33 PM, Snehal Shinde  wrote:

> switched to 4 secs now. also if its a packet loss issue will it make sense
> to reduce the $retry_interval from the default 15 secs to say 2 secs?
> http://us2.php.net/manual/en/memcache.setserverparams.php
>
> also the error that i get intermittenly is "COULD NOT CONNECT TO SERVE". Is
> there a way to find out more? why it was not able to connect? If I restart
> the memcached with -vvv option, will it give a lot more details in the error
> message? just trying to find a way to get more info
>
> snehal
>
>
> On Mon, Jul 12, 2010 at 11:21 AM, dormando  wrote:
>
>>
>> On Mon, 12 Jul 2010, Snehal Shinde wrote:
>>
>> > I am using the stable 2.x one. I have set the timeout to 3 secs now.
>> Lets see how that goes
>> > Snehal
>>
>> You might want to stick with 2 or 4 seconds to test :) putting it right on
>> the line with the SYN timeout will still give you inconsistent results...
>>
>
>


Re: memcached limitation

2010-04-19 Thread Gavin M. Roy
Are you evicting at all?  If you're not evicting, then you're not
likely to run out of space and you might just be seeing a normal
pattern for your data and storage time.

On Mon, Apr 19, 2010 at 3:58 PM, Darvin Denmian
 wrote:
> Somebody can help me?
>
> Thanks !
>
> On Mon, Apr 19, 2010 at 3:34 PM, Darvin Denmian
>  wrote:
>> Hello,
>>
>> I'm using memcached a few weeks ago and realized that memcached
>> reached a limit of 75% of
>> memory utilization. This utilization doesn't grow and I don't know why.
>>
>> I'm monitoring memcached with munin, bellow the link for "memcached bytes":
>>
>> http://img23.imageshack.us/img23/2289/memcachedbytesweek.png
>>
>> Is this correct?
>>
>> Thanks.
>>
>
>
> --
> Subscription settings: 
> http://groups.google.com/group/memcached/subscribe?hl=en
>


Re: Tools : phpMemCacheAdmin

2010-04-14 Thread Gavin M. Roy
It looks nice, we'll have to give it a try over here.  Thanks!

On Wed, Apr 14, 2010 at 2:25 PM, c.mahi...@of2m.fr  wrote:
> Hello all from Brittany(France), where we don't speak very well
> english, but with (I hope) a lovely accent!
>
> Certain time ago we started to use memcached at work (We make news
> website and classified ads) to drop load off our databases and finally
> we ended up using it in a regular basis in our new developments.
> Our developpers and sysadmin wanted a tool to develop, debug and see
> what is going on memcached server easily.
>
> So i develloped a tool named phpMemCacheAdmin : 
> http://code.google.com/p/phpmemcacheadmin/
> It's basicaly all we need in one small website with the look & feel of
> the memcached.org website, i hope people will find it usefull.
> Do not hesitate to give your comments, ideas and corrections.
>
> Thanks a lot and keep up the good work
> Cyrille
>
>
> --
> To unsubscribe, reply using "remove me" as the subject.
>


Re: the safe number of ESTABLISHED connection

2010-03-18 Thread Gavin M. Roy
We safely run in the 50k range per memcached.

Regards,

Gavin

On Thu, Mar 18, 2010 at 2:48 AM, Jumping  wrote:

> We have three servers, each installed apache and memcache.
> Monitored for some time and found that the number of connections have
> always been great.
>
> Now, my question is there any upper limit of the number of  ESTABLISHED
> connection ?
> Is there any relation of MAXCONN ?
>
>
> --
> Don't tell me how many enemies we have, but where they are!
> (ADV:Perl -- It's like Java, only it lets you deliver on time and under
> budget.)
>
<>

Re: Need help getting starting w/ python & memcache..

2009-08-03 Thread Gavin M. Roy
There is an easy to use pure python module called python-memcached available
at tummy.com:

http://www.tummy.com/Community/software/python-memcached/

You can install it by doing:

easy_install python-memcached

If you look at the memcache.py script, you'll see a usage example in the
tests towards the bottom in the if name == '__main__' condition.

Hope this helps.


On Mon, Aug 3, 2009 at 3:07 PM, JJ  wrote:

>
> I'm not seeing many examples on the web using memcache and python. Can
> someone show me a quick sample of how to set up, add and retrieve data
> from memcache?
>
> thanks,
> JJ
>


Re: python-memcached Fork

2009-07-24 Thread Gavin M. Roy
The version I released will de-serialize any of the supported formats
without having to specify (or know) the format of the serialized data in the
key, allowing for greater flexibility.

On Thu, Jul 23, 2009 at 5:26 PM, NICK VERBECK  wrote:

>
> I may be mis-understanding this or not seeing what problems you had
> but doesn't the current python-memcached lib support changing of the
> pickler class by simply changing the Client.pickler and
> Client.unpickler variables to the class that you wish to use. By which
> that class would operate like pickle itself does.
>
>
>
> On Thu, Jul 23, 2009 at 9:59 AM, Gavin M. Roy wrote:
> >
> > I have created a fork of the python-memcached library to add support
> > for other data serialization types.
> >
> > python-memcacheds supports de-serialization of Pickle, JSON and PHP
> > serialization.   It is based off of the current 1.44 version and
> > should future versions be released, I will apply the changes to those
> > subsequent releases.  The primary goal of this is to be able to use
> > memcached from multiple languages without regard to serialization.
> >
> > The current version of python-memcached will fail on data that has
> > been serialized in PHP because the PHP PECL library sets the flag to
> > the same value as the Python library.  When the Python library goes to
> > de-serialize the data, it will fail on PHP serialized data, expecting
> > pickle serialized data and returning False.
> >
> > I have submitted a patch to the maintainer of python-memcached, should
> > there be interest in applying these changes to the main library.
> >
> > python-memcacheds is available for download at:
> >
> > http://github.com/gmr/python-memcacheds/
> >
> > Regards,
> >
> > Gavin
> >
>
>
>
> --
> Nick Verbeck - NerdyNick
> 
> NerdyNick.com
> SkeletalDesign.com
> VivaLaOpenSource.com
> Coloco.ubuntu-rocks.org
>


python-memcached Fork

2009-07-23 Thread Gavin M. Roy

I have created a fork of the python-memcached library to add support
for other data serialization types.

python-memcacheds supports de-serialization of Pickle, JSON and PHP
serialization.   It is based off of the current 1.44 version and
should future versions be released, I will apply the changes to those
subsequent releases.  The primary goal of this is to be able to use
memcached from multiple languages without regard to serialization.

The current version of python-memcached will fail on data that has
been serialized in PHP because the PHP PECL library sets the flag to
the same value as the Python library.  When the Python library goes to
de-serialize the data, it will fail on PHP serialized data, expecting
pickle serialized data and returning False.

I have submitted a patch to the maintainer of python-memcached, should
there be interest in applying these changes to the main library.

python-memcacheds is available for download at:

http://github.com/gmr/python-memcacheds/

Regards,

Gavin


Re: mctop - memcache cluster monitoring utility.

2009-04-24 Thread Gavin M. Roy

On Fri, Apr 24, 2009 at 6:31 AM, gf  wrote:
>> the if's, elseifs are insane
> What's wrong? ;-)

A switch statement is cleaner for what you're doing there.


Re: mctop - memcache cluster monitoring utility.

2009-04-23 Thread Gavin M. Roy

Hi there,

You might want to consider using direct socket communication for this
instead of relying on having a specific memcache PECL library
installed.  Since you're just relying on the stats command which is
very easy to parse for.  Also you might consider the switch statement
instead of the big line of if and elseif's.

Otherwise it looks good, thanks for the additional version of this app.

Gavin

On Thu, Apr 23, 2009 at 7:09 AM, gf  wrote:
>
> Hello. I enjoy an idea of memcache monitoring utility.
> So I wrote mctop (http://code.google.com/p/mctop/).
> It provides some statistics of memcache cluster online. Very useful
> for monitoring and debugging purposes.
> Thanks to Nicholas for an idea.
> Welcome any comment and suggestions.
>


Menwith: text protocol command analysis tool

2009-04-11 Thread Gavin M. Roy
I was hacking about with the python bindings for libpcap today and threw
together a little app for grabbing memcache stats usage by listening to
traffic on the network card.  It only works with the text protocol, but I
figured it might be of some use to others:
http://github.com/gmr/menwith/tree/master

If you have ideas on how to make it better or have patches, feel free to
send either my way.

Example Output:


374 packets received, 0 packets dropped, 0 packets dropped by interface.
Listened for 21.198040 seconds.

Top 10 set commands:

 foo_bar_1052968749: 1
 foo_bar_1014930624: 1
 staplr.check: 1
 foo_bar_1204420773: 1
 foo_bar_1067674038: 1
 foo_bar_1107012199: 1
 foo_bar_1167916291: 1
 foo_bar_1130493593: 1
 foo_potd: 1
 foo_bar_1119236135: 1


stats requests: 1

Top 10 get commands:

 foo_member_2648: 8
 foo_member_3071: 6
 foo_member_6057: 5
 foo_member_5076: 4
 foo_member_6284: 4
 foo_member_13: 3
 foo_member_6003: 3
 foo_member_3030: 2
 foo_member_6053: 2
 foo_member_6275: 2


Regards,

Gavin


Memory Leaks in 1.2.6

2008-11-30 Thread Gavin M. Roy
I'm running into what appear to be memory leaks in my memcached farm.  Each
machine is doing around 7k commands a second.  The boxes have 32GB memcached
is setup to use 30GB.  Swappiness is set to 10 on these boxes, so I don't
believe that Linux would prefer to send the memory utilization in memcached
to swap.
I've attached a graph that demonstrates the memory leak driving the box into
swap.  I'm working on a plan to reboot one of the boxes daily which, it
appears based upon my usage, should give me three weeks before it goes into
swap.

Is anyone else running into memory leaks with 1.2.6?  How do people deal
with this?

Regards,

Gavin
<>

Re: Initializing memcache from disk

2008-09-19 Thread Gavin M. Roy
I wrote a simple script that uses a list of keys to replicate, which then
retrieves them and serializes them, saving them to disk, then I use a script
to prime servers I want this data loaded into.  This same concept could be
used to fetch from one server and write to another.
HTH,

Gavin

On Fri, Sep 19, 2008 at 3:52 PM, Chris <[EMAIL PROTECTED]> wrote:

>
> Hi all-
> I have a very simple and particular use case- I'd like to use
> memcached to serve a whole bunch of static data for the life of a long-
> running data processing task, and since I know what all this data is
> before the process starts, I'd like to be able to initialize the
> memcacheds with the values they will be serving when they start up
> rather than letting the data trickle in since I'd rather not have my
> clients know anything about where they should "really" get their data
> from.  According to the FAQ, "this is not the typical case at all,
> [but] it happens often enough that such a feature might appear in the
> future."  As this is my *only* use case, I'm writing to inquire if
> there is any movement on this front...
>
> If this isn't going to be supported, can any readers of this list
> recommend alternatives?
>
> Thanks!
> Chris
>


Re: Geographically distributed memcached clusters

2008-09-11 Thread Gavin M. Roy
You could use something like Apache ActiveMQ and consumer scripts to
accomplish this.  You could support the whole memcache grammar and have a
consumer that just repeats commands into distributed memcached clusters.
Regards,

Gavin

On Thu, Sep 11, 2008 at 3:27 PM, Chris <[EMAIL PROTECTED]> wrote:

>
> I was wondering if anyone had any better solutions for cache
> consistency with geographically distributed memcached clusters.
>
> The problem: Having just one big memcached cluster is great if you
> only have one datacenter, but if you have datacenters in a couple
> different locations around the world, latency becomes a big problem.
> Making a couple memcached queries from US -> Europe for a single
> client request can make page loads unacceptably slow.
>
> Our current solution to this problem is to have multiple memcached
> clusters, one for each geographic region (Europe/US/Asia).
> Unfortunately, keeping them in sync with the underlying data (mysql,
> using replication) in an unpleasant problem.
>
> Facebook had a solution to this that they wrote about on their
> engineering blog ( http://www.facebook.com/note.php?note_id=23844338919
> ).  They modified the mysql query grammar to support a list of keys to
> invalidate.
>
> Does anyone have any other interesting solutions to this problem?
> (Keeping in mind that "only using one memcached cluster" likely won't
> work because there is too much latency)
>