Re: key misses in memcached

2009-03-19 Thread Les Mikesell


Baskaran Sankaran wrote:


The key miss problem occurs, when I store all the three keys and their
values for the rules. I guess that the problem is due to the fact that the
every key is similar to two other keys except for the suffix part, though I
don't understand why this is a problem.
I would greatly appreciate any help.


You could simply be running out of memory - or there could be some kind 
of hash collision happening that would not be a problem the way memcache 
is normally used with an underlying database holding the authoritative 
copy.  However, you may have an even bigger problem since you want to 
update the values from multiple processes and you won't have any 
locking.  This seems like a problem that mysql or postgresql would solve 
easily in a machine with sufficient RAM.  Memcache is normally used 
where you want to read the same value thousands of times without 
bothering the underlying backend database.


--
  Les Mikesell
   lesmikes...@gmail.com



Re: New "wait timeout" argument for the get() method.

2009-03-25 Thread Les Mikesell


Dustin wrote:


On Mar 25, 9:31 am, gf  wrote:

Thank you for your anwer.
I can pay if necessary. How much it costs?


  I can build you a custom version of memcached that does whatever you
want, but you'd have to consider:

  1) This will not be part of the core memcached server -- so you'll
be kind of stuck with whatever build I make you.
  2) If you wanted to also run this as a memcached instance, the data
loss properties that make memcached such a good cache would conflict
with your lock/queue goals.

  Also, I don't think it's a very good idea, so a lot of the
negotiation time would be me trying to talk you out of it.  :)


If you put this in the server, don't you set up conditions for:

A) all clients trigger the wait and thus deadlock
and/or
B) some number of clients run the server out of resources

??

--
  Les Mikesell
   lesmikes...@gmail.com


Re: New "wait timeout" argument for the get() method.

2009-03-25 Thread Les Mikesell


gf wrote:

А)  It's possible if the timeout is big, I intend to use 0.1 as the
timeout.


Blocking everything for .1 sec would be a very bad thing. Is the update 
supposed to be done by one of the same clients that can be hung in this 
wait?  How does the updater distinguish itself from the rest?



B)  It's possible. But the same (or lower) number of clients repeating
get() every several ms run the server out of resources early.


A failing get() should only use time on the server - a resource that 
goes by whether you use it or not.  Waiting will consume an assortment 
of things to maintain the state - and should be done on the clients 
where the resources scale up with the number of them.



--
  Les Mikesell
   lesmikes...@gmail.com


Re: New "wait timeout" argument for the get() method.

2009-03-25 Thread Les Mikesell


gf wrote:

How does the updater distinguish itself from the rest?

acquire() (atomic add).


So a whole bunch of clients try to add some sort of key that you hope 
are identical so all but one fail, the one that succeeds is supposed to 
do some more work?  What if its next step fails?


--
  Les Mikesell
   lesmikes...@gmail.com


Re: memcached not always work

2009-03-28 Thread Les Mikesell


expream wrote:

Hello all!

I'm new to memcached. And hove some problems. I have a online game ...
and I'm using memcached... but sometimes I see that memcached dont
work.. 1 time from 20 memcached returned 0 instead of value... what
can be the problem?

I have pretty high load... netstat -np 11211 | wc -l is about
6 ... and there are a lot of TIME_WAIT connections... what
parametrs shuold I change... if I have a lot of visitors... ?


I've forgotten the exact values, but there is a theoretical limit to the 
number of TCP connections and the rate you can make them to a single IP 
address and port.  There's a 16-bit socket value combined with IP/port 
to find the end point, so you can only have 64k with the same IP/port 
open at once, and sockets are not re-used for the time it might take for 
a lost packet to make a round trip so it won't be associated with the 
new connection (that's your TIME_WAIT).  If you really need more than 
64, connections to one port, you'll have to add another IP address 
and round-robin to load balance them.  If you have fewer end points, 
each making new connections frequently, perhaps they can maintain a 
connection and re-use it.


--
  Les Mikesell
   lesmikes...@gmail.com



Re: Memcached monitoring/statistics tool

2009-03-30 Thread Les Mikesell


Josh Snyder wrote:

We have sizeable number of memcache instances running. We have some
simple Nagios alerts mainly checking for reachability and a handful of
Cacti graphs. However, in practice, memcached is extremely stable, so
we only get alerts when we've screwed something up, and the Cacti
graphs see pretty light usage. I wouldn't go nuts on worrying about
monitoring your memcache servers beyond the basics until you have a
solid sense for what your needs are; I would focus instead on
carefully monitoring your clients.


Does anyone deploy spare machines with some way to pick up the IP 
addresses of any that fail, or do you just make them all active and let 
the client re-balancing take care of any problems?


--
  Les Mikesell
   lesmikes...@gmail.com


Re: project division

2009-05-01 Thread Les Mikesell


maciejplonski wrote:

Hello,

I've got memcached installed on my VPS and also I've got there
blogging platform. I'm caching whole pages in memcached and serving
them by nginx. When one user posts sth, I need to flush whole
memcached and delete from cache also other cached blogs.

Is it possible to divide memcached to many 'blogs' and flush only
cache from one blog so other blogs will be still served from
memcached? This blogging platform is written in PHP.


If you know when and what you need to delete, why not just update the 
cache instead and not break anything else?  Or, keep track of an update 
count somewhere that you use in a key prefix so when a new post happens 
you just stop using the old copies and they'll age out naturally.


--
   Les Mikesell
lesmikes...@gmail.com



Re: project division

2009-05-02 Thread Les Mikesell


maciek wrote:

I like the idea with unique keys, but the problem is I'm loading data
from memcached by nginx, so keys must be in format '$http_host
$request_uri'.


Don't these get the article number as a component so new ones take care 
of themselves except perhaps for a posters home with the current list? 
Maybe you can make the home page have an iframe so the current list 
always checks the application - which can cache this at a component level.



idea with re-caching data - I'm not caching all pages from all blogs,
on only that one visited in last 10h


If you put stuff in that nobody wants it will be discarded as the least 
recently used when another item needs space - no need to do extra work 
to do that explicitly.


--
  Les Mikesell
lesmikes...@gmail.com



Re: project division

2009-05-02 Thread Les Mikesell


Clint Webb wrote:

Rather than using memcached as a global site cache (which it is not really
designed to be), you might have more success actually using it the way it
was intended.

Which means as an object cache inside your code.

Otherwise you are just going to be doing a lot of effort to get a square peg
to fit in a round hole.


There's not really anything wrong with using it as a page cache as well. 
 You just can't set the expire time on pages to a time past when they 
will change.


--
  Les Mikesell
lesmikes...@gmail.com




Re: project division

2009-05-02 Thread Les Mikesell


Clint Webb wrote:

On Sun, May 3, 2009 at 8:58 AM, Les Mikesell  wrote:


Clint Webb wrote:


Rather than using memcached as a global site cache (which it is not really
designed to be), you might have more success actually using it the way it
was intended.

Which means as an object cache inside your code.

Otherwise you are just going to be doing a lot of effort to get a square
peg
to fit in a round hole.


There's not really anything wrong with using it as a page cache as well.
 You just can't set the expire time on pages to a time past when they will
change.



On dynamic sites where you have to either delete your entire cache whenever
any changes are made to a single page, or you must go through extraordinary
measures to get around that limitation there certainly is.


If you can break what looks like a dynamic page into iframes that hold 
versioned contents, you can still cache a large percentage of the 
content at the http level.



You are right that there are cases where using it as a cache is
appropriate.  Actually I have used it to cache entire pages that are
dynamically generated, but not changed once generated   Other than that,
I cant think of a good use for it where other solutions aren't better.


It doesn't have to be an either/or proposition.  If you have a page 
frame that is uncached or has a short expire time, the underlying app 
just has to compute the appropriate urls to the cachable but versioned 
parts and you only have to generate those once.


--
  Les Mikesell
lesmikes...@gmail.com



Re: Cache "fails" when doing high volume of simultaneous read/write requests

2009-05-03 Thread Les Mikesell


Pallab Bhattacharya wrote:

On Sun, May 3, 2009 at 7:31 AM, Syed Ali  wrote:


How much memory are you giving to it? And how big are your objects?

It could be that they get evicted to make space for new onesand
therefore you dont find them in cache



it appears from his description that he uses the same key - so when it
is paced - there is a cache-hit because the first request would have
populated the cache with the key.

when he tries to race - obviously all threads face the same truth - the
looked up object is absent - so they all try to replenish the missing
object hence goes to db simultaneously,


So it is probably the concurrent activity at the db that slows it down 
and makes the problem visible.  That seems like it might be a common 
problem for sites where new items appear that might be very popular as 
soon as the link becomes visible.  Is priming the cache as these items 
are generated the best way to avoid this - or does it really just show 
up in automated testing?


--
  Les Mikesell
   lesmikes...@gmail.com



Re: memcached log file

2009-05-06 Thread Les Mikesell


rwthomas wrote:

Yes, I understand that a service runs a script. With memcached 1.2.2,
you could specify the logfile in the startup script (memcached-start)
in the /usr/local/bin dir.  The new version of memcached does not use
memcached-start.  I have tried to add redirects to the start script,
but the only thing it puts in the file that I am redirecting to is the
OK that comes when you start or stop the service. the memcached-start
file is actually a perl script.  Below is an example of what we used
to run:
#my $fd_reopened = "/dev/null";
my $fd_reopened = "/root/mem.log";
sub handle_logfile {
# my ($logfile) = @_;
 my ($logfile) = "/root/mem.log";
 $fd_reopened = $logfile;
}
sub reopen_logfile {
# my ($logfile) = @_;
  my ($logfile) = "/root/mem.log";
 open *STDERR, ">>$logfile";
 open *STDOUT, ">>$logfile";
# open *STDIN, ">>/dev/null";
 open *STDIN, ">>$logfile";
 $fd_reopened = $logfile;

as you can see, we redirected to mem.log. When we upgraded, we found
that memcached 1.2.8 does not use the memcached-start perl script.
that is why I am trying to find a way to do this again.
We are running CentOs 5.2 with memcached 1.2.8


Centos inherits the RedHat style init scripts which typically use the 
daemon() function in /etc/rc.d/init.d/functions to start programs - and 
it redirects stdout and stderr to /dev/null among other things.  You'll 
probably have to make the /etc/init.d/memcached script do the same 
things directly instead of using daemon() so you can control the 
redirection yourself.  It would be a little handier for this style of 
control if memcached had a command line option like '-o logfile' so it 
could be controlled in the options the script sources from 
/etc/sysconfig/memcached and expands on the command line.


--
  Les Mikesell
   lesmikes...@gmail.com



Re: Is memcached for me?

2009-05-12 Thread Les Mikesell


JonB wrote:
 
By the sound of it, memcached will work - it'll cost me network calls

(but not to the MySQL server) - the only remaining doubt I have is
over the data being stored in it.


If you are already doing network calls to mysql it is a pretty sure 
thing that memcached will not be slower than even a 'fast' mysql 
response on cache hits.



Not a lot of our data can be agregated before being cached - so we're
left again, looking in the cache for very small bits of data (a few
bytes to a few hundred bytes).

I'll have to sit down and work out where in the application it's
likely to sit, and whether the cost of the network calls etc. to get a
few bytes, is actually worth it.

I guess having a 'localhost' cache would avoid some of the overhead,
as would UDP.


Memcache will be somewhat slower than caching in the app's memory, but 
you trade that off for having to duplicate the RAM and initial fetch for 
each server and having the items expire at different times on each server.


--
  Les Mikesell
   lesmikes...@gmail.com


Re: memcached slower than file IO

2009-05-29 Thread Les Mikesell


Ved wrote:

Thanks David for your reply but what I mentioned are not my
assumptions

1. memcached is installed on the machine where my file is so that
takes care of your concern ( memory on a different machine ).


That doesn't matter - you still go through the same client/server 
motions to access it through a socket as if you have distributed storage.



2. I am not just reading a single file everytime. I have 3 data files
that I access in the script (system may be caching files in memory)
3. Even if the files are not changing does it mean that disk cache is
faster than memcached? that too an extent of disk cache being almost
50% faster than memcached.


Yes, if you have sufficient RAM, all recently accessed file data will be 
cached at the OS level for fast repeated access.



I am sorry, but I don't think your explanation addresses my concerns.


The part that didn't make sense was that you mentioned memcache having 
many failures.  Unless you have not provided sufficient RAM, you should 
only fail on the first access to new or expired data.  Perhaps with 
memcached running you don't have enough memory to hold your active data 
set in either the memcache cache or the now reduced filesystem buffers 
and end up making them both thresh.


--
  Les Mikesell
   lesmikes...@gmail.com




Re: memcached slower than file IO

2009-05-30 Thread Les Mikesell


Ved wrote:


There is 8 GB RAM on the server, and on first access apache bench
doesn't show any failed requests, but if I execute the program again,
I see that number of failed request show up, this is something that I
couldn't understand as why didn't the number of failed request show on
the first run and then appears every subsequent run (Total request for
each run : 10,000 and 200 cc).


Are these apache errors or errors in memcache?  If you are running a 
high concurrency in apache benchmark you may be running the server out 
of sockets or some other resource.



"Perhaps with memcached running you don't have enough memory to ...".
this is not the case in any which ways, have checked the memory and
had that been an issue even file IO would have more or less given me
the same performance.


I think you are missing the point that if you had just enough room for 
the data in the file buffers without memcache, then allocate a portion 
to memcache, neither one would have enough space and both would have to 
continuously reload the data as it is evicted.


--
  Les Mikesell
   lesmikes...@gmail.com




Re: memcached as http cache

2009-07-03 Thread Les Mikesell


googleuser wrote:

Hello,
I have some problems with apache.
If I use squid as proxy-cache I have auth problems. And if I use
mod_cache do not work because mod_cache uses rewrited url and not
requested url (all pages are the same for mod_cache).

These problems are hitting me to implement new http caching engine.
I think that memcached could be useful for this.
Anyone have some experience or info about memcached as http cache
engine. Performance, memory issues, posible implementations,...?


I haven't tried it, but this approach sounds fast:
http://www.igvita.com/2008/02/11/nginx-and-memcached-a-400-boost/

But what kind of auth problem do you have with squid?

--
  Les Mikesell
   lesmikes...@gmail.com



Re: Using memcached as a distributed file cache

2009-11-02 Thread Les Mikesell


dormando wrote:

You could put something like varnish inbetween that final step and your
client..

so key is pulled in, file is looked up, then file is fetched *through*
varnish. Of course I don't know offhand how much work it would be to make
your app deal with that fetch-through scenario.

Since these files are large memcached probably isn't the best bet for
this.


You could also redirect the client to the proxy/cache after computing 
the filename, but that exposes the name in a way that might be reusable.


--
  Les Mikesell
   lesmikes...@gmail.com



Re: How to check status of the server which will be chosen by Hashing Policy

2010-02-02 Thread Les Mikesell

Henrik Schröder wrote:
Unfortunately most client libraries perform server selection slightly 
differently from each other. It might be possible to get the same 
distribution if you use the naive server selection in both, and setup 
your list of servers the same way.


On the other hand, does it really matter? Changing your cache client is 
kinda a big deal, I wouldn't do that on a running system, what if you 
have processes that are in the middle of changing your cached data? No, 
your best option is to bring your application down, release the change, 
and bring it back up again. You might also want to flush the cache to 
make sure you won't get any synchronization errors.


On the other hand, it shouldn't matter.  The worst thing that should happen if 
one client picks a different server than another is that you use the memory less 
efficiently and you'll hit the backend data store a bit more frequently.  If you 
are counting on everything having a time-synchronized view of exactly the same 
data, you probably shouldn't be using a distributed cache.


--
  Les Mikesell
   lesmikes...@gmail.com




Re: Any plan for libev support?

2010-02-20 Thread Les Mikesell
The link is actually to a BSD-ish 'retain the copyright notice' license, with 
the GPL permitted as an alternative.




Trond Norbye wrote:

Then I guess the answer is no, because memcached is BSD...

Trond

Sent from my iPhone

On 20. feb. 2010, at 16.23, Ryan Chan  wrote:




On 2月18日, 下午11時27分, Paul Lindner  wrote:

I didn't see any mention of the license.  libevent is bsd, which 
integrates

well with the memcached license.



http://cvs.schmorp.de/libev/LICENSE?view=markup

GPLv2




Re: Memcache as session server with high cache miss?

2010-03-10 Thread Les Mikesell

On 3/10/2010 10:28 AM, Brian Hawkins wrote:

Explain how using memcached opens one self to a DOS attack?


If you are expecting it to be a persistent store by itself, simply 
exceeding capacity will drop data before you expect it to expire.  Of 
course if your sessions are tied to logins this would be harder to 
cause, and if you have a backing DB of critical entries then it's not a 
problem until you overwhelm the DB.


Memcache itself isn't a problem unless you expect it to always have your 
data, which it isn't intended to do.


--
  Les Mikesell
   lesmikes...@gmail.com



Re: Memcache as session server with high cache miss?

2010-03-10 Thread Les Mikesell

On 3/10/2010 10:52 AM, Carlos Alvarez wrote:

On Wed, Mar 10, 2010 at 1:28 PM, Brian Hawkins  wrote:

Explain how using memcached opens one self to a DOS attack?


Using memcached to store session data just relying in a previous
calculation of how many memory you will need (all premises) exposes
you to DOS because of the effect explained in other mails: it would be
very easy and some attacker would need a very low bandwith to force
the memcached to expell valid data. If your application relies on data
to be present on the memcached to work properly, you have a problem.

If you have a persistent store, it won't expell data because of space
constraints. Also, I find a lot more easier (and cheaper) to have a
4TB persistent store than a set of memcached.


But you'll find it very expensive to scale up the number of servers 
accessing that persistent store and the speed it can operate if you 
don't use something like memcache in front of it.


--
  Les Mikesell
   lesmikes...@gmail.com


Re: Memcache as session server with high cache miss?

2010-03-10 Thread Les Mikesell

On 3/10/2010 5:14 PM, moses wejuli wrote:

Yes, good point as far as service interruption is concerned but I  don't
see how this affects performance, especially if the programmer carefully
uses this feature for tiny amounts of data per user I just think,
given how far memcache has metamorphosed, the time is probably right to
include such a feature (to be used with some care of course)


You can't count on nothing ever going wrong.  How should this 
theoretically reliable storage mechanism respond to a network glitch to 
one or more of the servers?  Or just a miscalculation in terms of how 
much data you throw at it?


--
  Les Mikesell
   lesmikes...@gmail.com




Re: Memcache as session server with high cache miss?

2010-03-10 Thread Les Mikesell

On 3/10/2010 5:46 PM, moses wejuli wrote:

it's not so much a /"theoretically reliable storage mechanism"/ but only
storing data for as long as the programmer chooses or in this case, for
only as long as the user is logged on (data is expelled when the user
chooses to log out or is forcibly logged out for one reason or another).


Or until any component fails, needs a change, etc.


data miscalculation? i think you'd have to take care as a /dev/ for this
not to happen -- infact this is presently the case (think max slab size)


I'd guess that it's uncommon for memcache users to have any idea how 
many potential keys might be in use at once (constructing them from 
arbitrary sql queries, etc.).  Or to do anything to remove data.  You 
really can't iterate over it to see what needs to be removed - and where 
else would you store the keys so you'd know about them?


--
  Les Mikesell
   lesmikes...@gmail.com



Re: Memcache as session server with high cache miss?

2010-03-11 Thread Les Mikesell

On 3/11/2010 1:01 PM, Martin Grotzke wrote:

Hi,

I'm trying to follow this thread on my mobile, i hope i didn't miss
anything. But AFAICS it was not yet explained, when memcached might
drop cached data as long as there's enough memory and expiration is
not reached. Or is this not deterministic at all? Perhaps you can
point me to resources providing more details on this?


'Enough' memory may not be what you expect unless you understand how 
your data fits in the allocated slabs.  And I'm not sure what happens if 
the keys have hash collisions.


--
  Les Mikesell
   lesmikes...@gmail.com



Re: Memcache as session server with high cache miss?

2010-03-12 Thread Les Mikesell

On 3/12/2010 11:21 AM, martin.grotzke wrote:




Hi,



I'm trying to follow this thread on my mobile, i hope i didn't miss
anything. But AFAICS it was not yet explained, when memcached might
drop cached data as long as there's enough memory and expiration is
not reached. Or is this not deterministic at all? Perhaps you can
point me to resources providing more details on this?


'Enough' memory may not be what you expect unless you understand how
your data fits in the allocated slabs.  And I'm not sure what happens if
the keys have hash collisions.

What about setting the minimum slab size to 1 mb (-n 1048576) so that
there's only one slab and one can calculate with this?


After seeing more of this thread, I'm inclined to think that the problem 
that started it is really a misconfiguration or network issue.  While 
you shouldn't expect memcache to be a reliable store, the miss 
percentage should not double when you add another server.


--
  Les Mikesell
   lesmikes...@gmail.com


Re: How to get more predictable caching behavior - how to store sessions in memcached

2010-03-12 Thread Les Mikesell

On 3/12/2010 5:10 PM, Martin Grotzke wrote:

With my question "how do I have to run memcached to 'store' these
sessions in memcached" I was not referring to a general approach, but I
was referring to the concrete memcached options (e.g. -n 204800 for
200kb slabs) to use.

The post you mentioned is very high level and does not answer my
question. For this you should go into a little more depth.


Some details here:
http://dev.mysql.com/doc/refman/5.0/en/ha-memcached-using-memory.html
But it's still not very clear how much extra you need to make sure that 
the hash to a server/slab will always find free space instead of 
evicting something even though space is available elsewhere.


--
  Les Mikesell
   lesmikes...@gmail.com


Re: How to get more predictable caching behavior - how to store sessions in memcached

2010-03-12 Thread Les Mikesell

dormando wrote:



To be most accurate, it is "how many chunks will fit into the max item
size, which by default is 1mb". The page size being == to the max item
size is just due to how the slabbing algorithm works. It creates slab
classes between a minimum and a maximum. So the maximum ends up being the
item size limit.

I can see this changing in the future, where we have a "max item size" of
whatever, and a "page size" of 1mb, then larger items are made up of
concatenated smaller pages or individual malloc's.


So what happens when a key is repeatedly written and it grows a bit each time? 
I had trouble with that long ago with a berkeleydb version that I think was 
eventually fixed.  As things work now, if the new storage has to move to a 
larger block, is the old space immediately freed?


--
  Les Mikesell
   lesmikes...@gmail.com





Re: How to get more predictable caching behavior - how to store sessions in memcached

2010-03-14 Thread Les Mikesell

Martin Grotzke wrote:


Tomcat sounds like such a pisser :P Even with your backup thing I'd
probably still add an option to allow it to journal to a database, and I
say this knowing how to get every last ounce of efficiency out of
memcached.

Tomcat provides a PersistentManager ([1]) which allows to store sessions 
in the database. But this manager backups all sessions in batches every 
10 seconds. For one thing scalability of the application is then 
directly dependent from the database (more than it is already if a 
database is used) and there's a timeframe where sessions can be lost. If 
the session backup frequency is shortened, the database is hit more 
often. Additionally sessions are stored in the database again and again 
even if they were not changed at all. That was the reason why I decided 
not to use this.


What about tomcat's ClusterManager?  Doesn't that provide replication across 
server instances?


--
  Les Mikesell
   lesmikes...@gmail.com



Re: How to get more predictable caching behavior - how to store sessions in memcached

2010-03-14 Thread Les Mikesell

Adam Lee wrote:

well, it depends on what you mean by scalability... i'm personally of
the opinion that traditional sessions should be avoided if you want to
truly scale.


And yet, everyone wants dynamic pages custom-generated to the user's 
preferences.  So how do you reconcile that?  You can help things a bit by 
splitting pages into iframe/image components that do/don't need sessions, and 
you can make the client do more of the work by sending back values in cookies 
instead of just the session key, but I'm not sure how far you can go.


--
  Les Mikesell
   lesmikes...@gmail.com




Re: Memcached as web page cache

2010-05-19 Thread Les Mikesell

On 5/19/2010 1:46 PM, Sun-N-Fun wrote:

Apache Traffic Server looks good!  Has commands for deleting a
specific object from the cache.



I hadn't been paying attention.  Is that released and ready for prime 
time now?


--
  Les Mikesell
lesmikes...@gmail.com


Re: Is this really Distributed?

2010-06-10 Thread Les Mikesell

Dilip wrote:

We read that memcached is "Free & open source, high-performance,
distributed memory object caching system" Where as "distirbuted" is
not part of memcached servers. We have to have some client which knows
about all memcached servers and uses some hash based on key to
determine a server.

Is My understanding correct? If it is correct, we should remove
"Distributed" from the above definition.


The data is distributed - but the servers don't need to know anything about 
that.  Doesn't that still make it a distributed system?


--
  Les Mikesell
lesmikes...@gmail.com



Re: Is this really Distributed?

2010-06-10 Thread Les Mikesell

Dilip wrote:

Going by that definition:

All client server architectures are distributed.

like ftp, ldap, sql servers are all distributed.


How is the data distributed across many servers in these services?


As i understood, in distributed systems there is no single point of
failure.


Memcache is sort of a special case in that not finding a cached item is not a 
failure - it is an expected event and the client is expected to retrieve the 
data from the actual source and refresh the cache.  If a server fails, this 
cache refresh will go to a different server.



but in all these cases there are single point of failures.

internet is distributed because there is no single point of failure.

But after looking at the link 
http://en.wikipedia.org/wiki/Distributed_computing,
here client server architecture is termed as distributed.
I think the responsibility of not having single point of failure is to
have intermediary clients, which can do that.

Now I think we can call it that way.


A cache server failure shouldn't have any visible effect other than making the 
source servers work harder while the data it held is refreshed onto the remapped 
servers.


--
  Les Mikesell
   lesmikes...@gmail.com



Re: Problems with ping latencies...

2010-06-18 Thread Les Mikesell

On 6/18/2010 2:41 PM, Ryan Amos wrote:


The only thing installed on this server is memcached, so all the
connections are memcached connections.  It's also the only port open via
iptables, other than one additional port for monitoring software.


It's not necessarily that machine.


I'm more curious if anyone has had this problem before and knows how to
solve it.


This is probably the wrong place to diagnose network problems, but you 
need to look at network capacity and traffic across the equipment 
between the machines.  You might have something else using all the 
bandwidth or perhaps a duplex mismatch at a switch port.


--
  Les Mikesell
lesmikes...@gmail.com


Re: Scalability and benchmarks

2010-06-30 Thread Les Mikesell

On 6/30/2010 5:35 PM, dormando wrote:

With what kind of boxes would that be?

With 300-500k/sec you're getting really close to lowlevel limitations of
single network interfaces. With dell 1950's (with broadcom netextreme II 5708
and dual xeon 5150) we were able to produce about 550-600,000 packets/second
with traffic/load-generating software (pktgen in the linux kernel) to test
ddos protection. And that was with fire-and-forget 64byte tcp or udp-packets.
Not with traffic some server was actually producing useful responses to
requests it received earlier.

With a much more recent Dell R210 (broadcom netextreme II 5709 and core i3
530) we were able to reach twice that though. That one was able to reach about
1.1 million pps. But still, that's with a packet generator generating unusable
traffic. If you actually have to read the requests, process them and produce a
response with a body, reaching up to 500k requests/second even on higher grade
hardware with multiple interfaces sounds pretty good to me.


For most hardware memcached is limited by the NIC. I'd welcome someone to
prove a simple case showing otherwise, at which time we'd prioritize an
easy fix :)


Does that mean you should use multiple NICs on the servers and spread 
the clients over different networks?


--
  Les Mikesell
   lesmikes...@gmail.com



Re: Scalability and benchmarks

2010-07-01 Thread Les Mikesell

On 7/1/2010 9:37 AM, dormando wrote:


Given the title, the overtly academic content, and the lack of serious
discussion as to the application of such knowledge, we end up with stupid
threads like this. Imagine how many people are just walking away with that
poor idea of "holy shit I should use REDIS^WCassandra^Wetc because
memcached doesn't scale!" - without anyone to inform them that redis isn't
even multithreaded and cassandra apparently sucks at scaling down. Google
is absolutely loaded with people benchmarking various shit vs memcached
and declaring that "memcached is slower", despite the issue being in the
*client software* or even the benchmark itself.

People can't understand the difference! Please don't confuse them more!

There are *many* more interesting topics with scalability gotchas, like
the memory reallocation problem that we're working on.


I have the cache spread across about 20 servers per site, with the 
servers also doing some other work, and could add more if the 
performance of a single server ever becomes an issue.  The question I 
find more interesting and probably a lot harder to nail down is what 
kind of performance impact will it have if one or a few of the servers 
go down at a busy time.  Ignoring the impact on the origin servers, how 
long does it typically take a client to figure out that a server is gone 
and what happens if it is supposed to be fielding 100k requests/second 
at the time?  And do all the different clients rebalance in the same way 
once they notice a configured server is dead?


In real-world situations I think the client performance is much more 
important than the server, especially since in this case it has to deal 
with the load balancing and failover logic - and you can just add more 
servers if you need them.


--
  Les Mikesell
   lesmikes...@gmail.com


Re: stats help

2010-07-25 Thread Les Mikesell

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: stats help

2010-07-25 Thread Les Mikesell
I know rrdtool (and the jrobin equivalent in java) can do it, but that's a 
fairly low level tool.  I was hoping to find some generic framework that could 
accept either counter or gauge type values and do the rest for you including a 
web graph display.  I'd think this would be a common problem but I haven't found 
any high-level tools that aren't married to snmp for the input.


 -Les


Gavin M. Roy wrote:
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.





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 <mailto:lesmikes...@gmail.com>






Re: REST API

2010-07-28 Thread Les Mikesell

On 7/28/2010 10:16 AM, jsm wrote:

Gavin,
You are right about the overhead and also saw that API's exist for
most of the languages as well.
I thought REST API would make memcached language agnostic.
I would like to hear from the community if the REST API should be
pursued or not?


I'm not quite sure how a rest api could deal with the distributed 
servers without a special client anyway.  But, it might be handy to have 
a web service that mapped a rest api as directly as possible to memcache 
operations where the http side would use traditional load balance/fail 
over methods and handle the http 1.1 connection caching.  I'm sure there 
would be places where this could be used by components that have/want 
data in a cache shared by more efficient clients.


--
  Les Mikesell
   lesmikes...@gmail.com


Re: REST API

2010-07-28 Thread Les Mikesell
There's no argument that embedding a locally-configured memcache client 
library for the appropriate language into your program would be more 
efficient, but consider the case where you have many programs in many 
languages sharing the cache data and some of them have inherent http 
capability and aren't used enough to care about that last 10% efficiency 
when it means rewriting a bunch of code with new libraries to get it. 
However, I still think the http interface would have to be a separate 
standalone piece, sitting over a stock client that knows about the local 
distributed servers or you'd need a special client library anyway.


 -Les


On 7/28/2010 12:53 PM, Adam Lee wrote:

memcached's protocol is, as has been pointed out, already language
agnostic and much more efficient than trying to do HTTP.  If you're
saying RESTful in the "not necessarily HTTP" sense, though, then I'd say
that memcached's text protocol is basically already as RESTful as you're
going to get- think of commands as verbs ('get,' 'set,' 'add,' 'delete,'
etc...) and the key as a URI and you're basically in an analogous
situation that I think basically meets the criteria as much as you can
(hard to have a stateless cache)...
http://en.wikipedia.org/wiki/Representational_State_Transfer#Constraints

If you want a key-value datastore with an HTTP interface, though, might
I recommend Tokyo Tyrant?  It speaks memcached and its own binary
protocol as well: http://1978th.net/tokyotyrant/spex.html#protocol

On Wed, Jul 28, 2010 at 12:03 PM, Les Mikesell mailto:lesmikes...@gmail.com>> wrote:

On 7/28/2010 10:16 AM, jsm wrote:

Gavin,
You are right about the overhead and also saw that API's exist for
most of the languages as well.
I thought REST API would make memcached language agnostic.
I would like to hear from the community if the REST API should be
pursued or not?


I'm not quite sure how a rest api could deal with the distributed
servers without a special client anyway.  But, it might be handy to
have a web service that mapped a rest api as directly as possible to
memcache operations where the http side would use traditional load
balance/fail over methods and handle the http 1.1 connection
caching.  I'm sure there would be places where this could be used by
components that have/want data in a cache shared by more efficient
clients.

--
  Les Mikesell
lesmikes...@gmail.com <mailto:lesmikes...@gmail.com>




--
awl




Re: REST API

2010-07-28 Thread Les Mikesell

On 7/28/2010 1:43 PM, Marc Bollinger wrote:

"and some of them have inherent http capability and aren't used enough
to care about that last 10% efficiency when it means rewriting a bunch
of code with new libraries to get it."

But you're..._adding_ support for memcached to that system. If this were
a system already using memcached, it'd be...speaking memcached. If it
were using a different, external caching system, you'd probably expect
some measure of integration code, or at least testing it if, like
Tyrant, it did speak the same protocol you were expecting. The only
other case would be if you weren't using some external cache already, in
which event you're going to be adding logic, regardless.


I think we don't have the same concept of "the system".  Mine is that 
unrelated programs may be using the same data and only some of them are 
designed around memcache and need its speed.  Maybe it would be better 
to embed memcache into a traditional http proxy for the things that 
don't to avoid having the cache miss logic everywhere.


--
  Les Mikesell
   lesmikes...@gmail.com


Re: REST API

2010-07-29 Thread Les Mikesell

On 7/29/2010 8:54 AM, j.s. mammen wrote:

Folks, lets not get bogged down by REST defined by  Roy Fielding in
2000.

My question was simple.
Here it is again, rephrased.

Do we need to implement a memcached layer whereby we can access the
cached objects by using HTTP protocol. Here is an example of getting a
cached object from a server
GET [server]/mc/object/id1

Hope the question is clearer now?


I can see an advantage if it let you get/put data using facilities most 
languages have built-in instead of needing an add-on client library. 
But, I don't see how you would handle the [server] part without 
re-creating all of the logic in the client library anyway.


--
  Les Mikesell
   lesmikes...@gmail.com


Re: Don't quite understand why expiration is necessary

2010-08-03 Thread Les Mikesell

On 8/3/2010 12:41 PM, Peter wrote:

Thank! Now it makes more sense to me!

Dustin, how do you do to avoid expiration date in your application?



For most of the places where you would use memcache it shouldn't matter. 
 That is, your persistent backend data store should be hand cache 
misses (for any reason, including expirations) and the point of the 
cache is just to not overwhelm it with thousands of requests for the 
same thing.


--
  Les Mikesell
   lesmikes...@gmail.com


Re: 1TB memcached

2010-09-21 Thread Les Mikesell

On 9/21/10 1:26 AM, MikeG. wrote:

Sorry I used blob to describe the final deliverable bundle not DB
blob.

As far as having partial objects in memory - this should never
happened based on my
intended design.
I would like to have the entire DB permanently in cache. Since I don't
have that much RAM on one machine
I plan to use virtual memory or memory mapped files. In this case my
only limit is as big as
my hard drive I'll get.


Why do you expect the file activity of virtual memory to be any faster than a 
traditional database designed to use files efficiently?  I'd expect the 
opposite.  You should generally assume that the disk head is going to be halfway 
across the disk from the data you want and add up the seek time it will take to 
get there.  On the other hand, using real memory across several machines is very 
fast.


--
  Les Mikesell
   lesmikes...@gmail.com


Re: 1TB memcached

2010-09-22 Thread Les Mikesell

On 9/22/2010 11:59 AM, Matt Ingenthron wrote:

On 9/22/10 6:12 AM, ligerdave wrote:

MongoDB is actually "cached" db, meaning that, most of its records are
in memory.

I think there is also a memcached and DB hybrid which comes w/ a
persistent option. i think it's called memcachedDB, which runs a in-
memory db(like mongodb). this shares most of common api w/ memcached
so you dont have to change code very much


membase is compatible with memcached protocol, has a 20MByte default
object size limit, lets you define memory and disk usage across nodes in
different "buckets".

memcacheDB is challenging to deploy for a few reasons, one of which is
that the topology is fixed at deployment time.


Does anyone know how these would compare to 'riak', a distributed 
database that can do redundancy with some fault tolerance and knows how 
to rebalance the storage across nodes when they are added or removed? 
(Other than the different client interface...).


--
  Les Mikesell
   lesmikes...@gmail.com


Re: Is memcache add() atomic on a multithreaded memcached?

2010-10-17 Thread Les Mikesell

On 10/17/10 6:07 AM, Tobias wrote:

Is it ever possible that your compute takes longer than your timeout?


no, the return value of "memcache.delete("lock" + x) is true.


But wouldn't that also be true if another process found the expired lock and set 
a new one?


--
  Les Mikesell
   lesmikes...@gmail.com



Re: features - interesting!!

2011-02-04 Thread Les Mikesell

On 2/3/11 11:40 PM, Roberto Spadim wrote:


LOCK (create a key-value, always return value)
UNLOCK (delete key-value, if key-value=sent(key-value) delete, return
before delete value, if not exist return blank or null)

that's it easy not?


What happens when the server holding the lock value is rebooted?  Or needs to 
evict values from memory?  For memcache's real purpose those things don't affect 
operation because the client will reload the correct values on the next access. 
 Where is the persistent backing store for this value?


> timeout could work too (it's key-value based)

Memcache is a cache, not a key-value store.

--
  Les Mikesell
   lesmikes...@gmail.com



Re: features - interesting!!

2011-02-04 Thread Les Mikesell

On 2/4/2011 9:34 AM, Roberto Spadim wrote:



What happens when the server holding the lock value is rebooted?  Or needs to evict 
values from memory?  For memcache's real>purpose those things don't affect 
operation because the client will reload the correct values on the next access.  
Where is the>persistent backing store for this value?


if elockd/lockd/any other lock server die, what happen? (non vollatile
or vollatile? it's a app problem not memcache problem, app must know
what happen, just it.


If they are designed to be reliable, the value will be stored 
redundantly and the system will know how to retrieve the copy that is 
still valid or an error if that is impossible. It is an application 
problem.  It is not an error if a cache cannot return data.  For a lock 
you must have the correct value or an error condition.  And it doesn't 
make sense to have the memcache server check for the difference on every 
request when the client could just call an application designed for the 
more complex operation you need when it knows it needs a lock.



with memcache we have volllatile, with memcachedb we have non
vollatile, put at main memcache and i will work with memcachedb and
repcache to sync this new feature at others memcache forks


It probably can be done with membase.  I don't think memcachedb is 
intended to be reliable.



who will use memcache for lock and don't want loose keys change
memcache command line to don't delete cache keys if cache is full
non volatille?


That still doesn't work in the usual scenario where you have many 
memcache servers and expect them to keep working even if some are down.



timeout could work too (it's key-value based)

Memcache is a cache, not a key-value store.


nice, it's a cache (can loose information) it's a key-value store with
timeout and volatille data, right? define cache! (volatile memory? how
to cache? based on key-value? based on memory address? it's a
key-value store! working as a cache! it could be a address-value store
too, but it's a key-value store... and can loose information, app must
know this!)


A cache must have a method where the correct value can be retrieved when 
it is empty.  How can either the clients or server replenish the value 
of the lock when it is gone for any reason?



i use memcache for store some values with pic18f4550 and it's very
good, since my pic have low memory and my server have a lot of memory


Yes, it is very good for holding values for quick access that you are 
able to retrieve in some slower way.


--
  Les Mikesell
   lesmikes...@gmail.com


Re: features - interesting!!

2011-02-04 Thread Les Mikesell

On 2/4/2011 11:25 AM, Dustin wrote:




easy? with it i can have 3 or more send/receive removed from my
pic18f4550 code (save a lot of rom for me)


   Are you sure you're not looking for a job server (gearmand,
beanstalkd, etc...)?  Perhaps your mistake is in doing any of the
processing on your PIC.


Or if you are using it like a database, membase might be a better fit 
without making much difference on the client side.  If you have another 
way of loading the data you could remove the part that handles cache 
misses from the client.


--
  Les Mikesell
   lesmikes...@gmail.com



Re: features - interesting!!

2011-02-04 Thread Les Mikesell

On 2/4/2011 11:40 AM, Roberto Spadim wrote:

nice =]
but it don´t have lock too :/


Isn't this a lock?
http://wiki.membase.org/display/membase/getl+extended+operations
I guess it is new and experimental.  Then again, yours would be too.

> today i´m using repcache, i never have

problem with lose of information (i´m using a good ups too)
the only problem is the PIC code is consuming a lot of ROM and time
(many network i/o) and i can´t use many PICs in the same time since
the network band is just 10mbit, in future i will replace to ARM with
linux but today i can´t do that for many users :/


If you really need atomic operations, maybe redis would be better.

--
  Les Mikesell
   lesmikes...@gmail.com


Re: features - interesting!!

2011-02-04 Thread Les Mikesell

On 2/4/2011 12:40 PM, Roberto Spadim wrote:

ehehe i know that there´s many others lock server,
but i don´t have ROM on my PIC18f4550 to put two libraries =( it would
be nice if i had a ARM or a x86 :/, but i don´t have :(
if i use memcache i could do it with my PIC


Do you already have enough of a library to make http client requests?  A 
lot of the servers provide a rest interface.


--
  Les Mikesell
   lesmikes...@gmail.com




Re: features - interesting!!

2011-02-04 Thread Les Mikesell

On 2/4/2011 1:16 PM, Roberto Spadim wrote:

i will learn more about redis, i didn´t see a lock server with cache yet
my today app work today, but it´s not very good/fast (i have a network
bootneck today)
i rewrite to redis protocol is very poor :(
if i can´t do anythink i will try a proxy between memcache and client
and implement lock and unlock there, but it´s not so good, but solve
my problem
maybe in future put in memcache could be nicer =)
i will study more and tell what i used
thanks =]


If you are relying heavily on your server anyway, why not put all of the 
application logic there and just speak http from the client?


--
  Les Mikesell
   lesmikes...@gmail.com




Re: features - interesting!!

2011-02-04 Thread Les Mikesell

On 2/4/11 9:56 PM, Roberto Spadim wrote:

problem:
today i need 4 packets to make 'lock'/'unlock' using memcache
i need to use less ROM/CPU/RAM/network at client side


What's the big picture here?  If you want your client to do less work, why not 
run a web service on the server that not only implements the lock but also  does 
most or all of what the client would have done while holding the lock?


--
  Les Mikesell
   lesmikes...@gmail.com


Re: Problems when one of the memcached server down

2011-03-08 Thread Les Mikesell

On 3/8/2011 1:40 PM, Evil Boy 4 Life wrote:

Thanks guys, I turned off the failover in the client...
In fact, I didn't know that there are several .net clients and now I
get confused, because I don't know which one is better (now I use
memcacheddotnet)
Do you know if one of the .net clients support replication in any way?


Memcache isn't supposed to do replication - it's a cache that you should 
be able to replenish from the real data source.   What happens when one 
server fails depends on the client hash mechanism.  Some people want the 
load to be rebalanced evenly over the remaining servers, some don't. 
Either way, the next attempt to use a failed server should detect it is 
down and retrieve the data from the backing DB.


--
  Les Mikesell
   lesmikes...@gmail.com




Re: It's a long story... (TL;DR?)

2011-03-09 Thread Les Mikesell

On 3/9/11 8:36 PM, dormando wrote:


So when you CRUD against the database, you send another command with the
UDF in it to DELETE or SET against the memcached cluster local to that
database. You can pair it inside a dummy INSERT or UPDATE or trigger or
sproc or whatever floats your boat. (unless I missed something and you
don't use mysql at all).


I thought the scenario was that he was updating a single master database which 
then replicates to remote read-only copies, and the client that just did an 
update may immediately read back a stale cache version from a different location 
instead of what it just changed.   The real problem is the speed the replication 
propagates, so having the db push the cache update at each location probably 
can't fix it.


--
  Les Mikesell
   lesmikes...@gmail.com



Re: Implementation of CHECK command for memcached

2011-03-18 Thread Les Mikesell

On 3/18/2011 3:12 PM, Oleg Romanenko wrote:

Hi.


How could this be put to use?  i.e. when is knowing that
something exists at some point in an ephemeral store useful to an
application?


This command provides support for lazy read operation. You can read
the value of the key only when is really necessary.
For example:
1. I am storing some information about the client in memcached. The
key - is the name of the session, which is is given to the client.
2. I have a lot of service scripts that should check the rights of
clients. They need only to know whether there is a key (then
everything is OK) or not (then the client is redirected to the login
script).
3. And I have only two scripts that use the value of a key in they
work.

Of course, this problem can be solved by creating an additional (flag)
key(s) without content. But such approach is less secure and in
generally reduces the consistency of system's data (for example, key
with data can be deleted when the flag key still remain available).


Seems odd to not care about the content in a cache where you aren't 
guaranteed any relationship from one access to the next.  That is, don't 
you have situations here where a check would say a key exists but when 
you try to retrieve it, it doesn't (expired, evicted, deleted by a 
concurrent operation, etc.)?


--
  Les Mikesell
   lesmikes...@gmail.com



Re: Implementation of CHECK command for memcached

2011-03-18 Thread Les Mikesell

On 3/18/2011 4:03 PM, Roberto Spadim wrote:

check have a low network traffic, i think it´s a nice command


Yes, and I don't see why it would be a problem to implement.  I just 
don't see the point when by the time you get the answer it might not be 
true, and if you try to apply an new expire with it the underlying value 
for the key might have already been changed or removed.  It just doesn't 
seem to mesh with the operations that work in a cache.


--
  Les Mikesell
lesmikes...@gmail.com



Re: Implementation of CHECK command for memcached

2011-03-18 Thread Les Mikesell

On 3/18/2011 5:28 PM, Roberto Spadim wrote:

hummm i think it´s a cache feature...
for example, if a key of cache is
key_1 , key_1_1, hey_1_2 , key_1_3, key_1_
if we check key_1 and it return not exists, we don´t need to check key_1_1,2,3,4
it´s a feature, some cache problems could get improvement with it.
i think it´s very good =)
think about http sessions
just check if a variable exists in cache (it can be very big)
if not exists get from session database (invalidade all cache values (delete))


What if the reason it doesn't exist is that it just got evicted - but 
some or all of your related keys might still be there?  Or maybe the 
server holding that key just went down.



if exists get all cache values from cache


Likewise they may be evicted/expired separately.

--
  Les Mikesell
   lesmikes...@gmail.com



Re: Memcachd with httpd to cache user stickyness to a datacenter

2011-04-11 Thread Les Mikesell

On 4/11/2011 12:07 PM, Mohit Anchlia wrote:

Yes it is a big deal for the business otherwise I wouldn't be posting
it here asking for suggestions. I respect everyones input and
thanksful for that, but I need to see if it will work for us too :)

Agreed, it's not a rocket science.


It is at least non-trivial to keep failover across data centers (which 
is often why you have more than one) but make sessions stick to one site 
as long as it is up, so it is worth putting some thought into it. 
Usually browsers will cache the IP address for the duration of a session 
anyway, but if you are running through a proxy it will repeat the DNS 
lookup frequently and switch addresses if you have alternatives.


--
  Les Mikesell
   lesmikes...@gmail.com


Re: Memcachd with httpd to cache user stickyness to a datacenter

2011-04-11 Thread Les Mikesell

On 4/11/2011 1:04 PM, Mohit Anchlia wrote:

Yes that's correct. After giving it a thought and seeing how
complicated this approach was becoming, we have decided to change our
API calls to include user identifier in query string. We use LTM F5
and we will persist user info at F5 LTM with expiry set to 1 hr.


If you have an LTM, you can just set its internal cookie persistence 
mechanism to tie a session to a particular server in the pool without 
doing anything different in the application. The initial connection will 
be balanced however the pool is configured. But that's only within the 
pool at a single data center (the L in LTM meaning local...) where the 
servers probably all have access to the same memcache service.


--
  Les Mikesell
   lesmikes...@gmail.com


Re: Understanding MemCached

2011-07-21 Thread Les Mikesell

On 7/21/2011 3:58 PM, Organic Spider wrote:

Hi Brian,

Yes have had a good read and still feel a little lost and stupid. What triggers 
each node to have the cache populated ?


The client has to populate the data after a get attempt for a key fails.


How does the data move between each node ?


The other client's gets will succeed until the time to live expires. 
When that happens, the client making the failing request should pull a 
copy of the data from your database and refresh it in memcache.



Or, is what I am requiring the repcached mod to replicate the data ?


As long as your clients are configured with the same list of servers in 
the same order they will find a single copy.


--
  Les Mikesell
   lesmikes...@gmail.com


Re: Memcached as a distributed hash

2011-08-25 Thread Les Mikesell
On Thu, Aug 25, 2011 at 4:13 PM, Organic Spider
 wrote:

> again am exploring how I may use memcached to distribute data between 
> multiple nodes; with one being the central hub. Yes I could use MySQL with 
> Master/N+slaves but that is such a large overhead on each node when it is not 
> really necessary. Have any of you used it for this purpose ? ie. central hub 
> either queries/or an insert/delete triggers and the data is pushed to a local 
> memcached instance which is then distributed between all other nodes. Each 
> node either 1) can detect that the memcache has updated 2) periodically uses 
> the memcache data to perform a task.
>
> Would be very interested on your input.

That's not what memcache does.  The value is only sent to and stored
on one node, determined by hashing the key.

-- 
  Les Mikesell
   lesmikes...@gmail.com


Re: Several clients

2011-08-26 Thread Les Mikesell
On Fri, Aug 26, 2011 at 2:36 PM, Neeraj Agarwal  wrote:
> Thanks for sharing it.
>
> I'm an undergrad student so still lack on quite a things.
>
> Again, thanks!
>
> But, its so awesome to play with memcached. Just thought of this
> point, so shared here :)
>

Note that having a temporarily different server list won't actually
break anything any more than having one or a few servers down in a
cluster with appropriate capacity, so you don't have to stop
everything at once to reconfigure for more servers.  You just end up
with some higher percentage of cache misses and maybe some extra
copies of data on other servers until it expires.

-- 
  Les Mikesell
   lesmikes...@gmail.com


Re: Memcached as a distributed hash

2011-09-09 Thread Les Mikesell
2011/9/9 Ted Zlatanov :
>
> No one here has tried Membase or Couchbase?  That's surprising.  I am
> interested in them as compared to plain memcached so I hope this is the
> right place to discuss them.
>

They are very different things.  Memcache is used where you have some
other persistent storage or way to generate the data and you want to
avoid the overhead of making a query for repeated requests.   If you
are going to use something that also provides the persistent storage
you need to consider whether you need more than key/value operations.

-- 
  Les Mikesell
lesmikes...@gmail.com


Re: LONG-CONNECTION-SOCKET FOR PROTOCOL BUG

2011-11-01 Thread Les Mikesell
On Mon, Oct 31, 2011 at 9:51 PM, unique  wrote:
> Besides, it's a pity that Memcached can't support shared memory(on
> Linux platform). the whole data-cache will All-lost just by updating
> Memeached

I think you are kind of missing the point of memcache if you you don't
spread server instances over many machines so that restarting one (or
a failure) just invalidates a small portion of the cache that your
persistent data store can easily handle.  If you want persistence,
there are probably better tools.

-- 
  Les Mikesell
lesmikes...@gmail.com


Re: recommended maximum number of nodes in memcache cluster (server pool)

2011-11-26 Thread Les Mikesell
On Sat, Nov 26, 2011 at 7:15 AM, Arjen van der Meijden  
wrote:
> Wouldn't more servers become increasingly (seen from the application) slower
> as you force your clients to connect to more servers?
>
> Assuming all machines have enough processing power and network bandwidth,
> I'd expect performance of the last of these variants to be best:
> 16x  1GB machines
>  8x  2GB machines
>  4x  4GB machines
>  2x  8GB machines
>  1x 16GB machines
>
> In the first one you may end up with 16 different tcp/ip-connections per
> client. Obviously, connection pooling and proxies can alleviate some of that
> overhead. Still, a multi-get might actually hit all 16 servers.

That doesn't make sense.  Why would you expect 16 servers acting in
parallel to be slower than a single server?  And in many/most cases
the application will also be spread over multiple servers so the load
is distributed independently there as well.

-- 
   Les Mikesell
 lesmikes...@gmail.com


Re: recommended maximum number of nodes in memcache cluster (server pool)

2011-11-26 Thread Les Mikesell
On Sat, Nov 26, 2011 at 2:05 PM, moses wejuli  wrote:
> @Les, you make a clear and concise point. thnx.
>
> In this thread, i'm really keen on exploring a theoretical possibility (that
> could become very practical for very large installations):
>
>     -- at what node count (for a given pool) may/could we start to
> experience problems related to performance  (server, network or even client)
> assuming a near perfect hardware/network set-up?

I think you can hit a point in number of requests in a multiget where
increasing servers doesn't help speed up that single query (because
you are limited by client cpu making the request), but having more
servers isn't actually a problem.

>     -- if a memcacached client were to pool say, 2,000 or 20,000 connections
> (again, theoretical but not entirely impractical given the rate of internet
> growth), wud that not inject enough overhead -- connection or otherwise --
> on the client side to, say, warrant a direct fetch from the database?

You will likely have to worry about the persistent backend database
scaling long before that point.

-- 
Les Mikesell
   lesmikes...@gmail.com


Re: recommended maximum number of nodes in memcache cluster (server pool)

2011-11-26 Thread Les Mikesell
On Sat, Nov 26, 2011 at 3:19 PM, Arjen van der Meijden  
wrote:
> On 26-11-2011 19:28 Les Mikesell wrote:

>>> In the first one you may end up with 16 different tcp/ip-connections per
>>> client. Obviously, connection pooling and proxies can alleviate some of
>>> that
>>> overhead. Still, a multi-get might actually hit all 16 servers.
>>
>> That doesn't make sense.  Why would you expect 16 servers acting in
>> parallel to be slower than a single server?  And in many/most cases
>> the application will also be spread over multiple servers so the load
>> is distributed independently there as well.
>
> Why not? Will it really be in parallel? Given that most application code is
> fairly linear (i.e. all parallelism will have to come from the client
> library). Even with true parallelism, you'll still have to connect to all
> servers, be hindered by slow starts, etc (a connection pool may help here).

Are you only expecting to run one client that only makes one query at once?

> I'm just wondering whether the connection and other tcp/ip overheads will be
> outweighed by any load-spreading gains. Especially since memcached's part of
> the job is fairly quick.

If you are facebook-size, you might want to convert to udp, but I
thought that was more more of a number-of-client-connection issue for
them from a bazillion preforked apache processes all connecting
separately to the servers.

-- 
   Les Mikesell
 lesmikes...@gmail.com


Re: recommended maximum number of nodes in memcache cluster (server pool)

2011-11-27 Thread Les Mikesell
On Sun, Nov 27, 2011 at 10:58 AM, Arjen van der Meijden
 wrote:
>>
>> Are you only expecting to run one client that only makes one query at
>> once?
>
> Obviously not. But the performance is mostly interesting from the
> client-perspective, that's the one your users are waiting on.

But which client? Usually if you need memcache to scale you will be
running many clients in parallel - and if they are doing single-key
operations in many cases adding more servers will make them completely
separate.   It is only multi-gets with many small keys that don't
scale forever.

> If you can
> manage to send every user's request to only a few memcached-instances,
> regardless of how many there are, than the server side is basically just
> resource planning.
> So in that regard, there isn't really an upper limit to the amount of
> servers. But for practicality, you'll likely be limited by the amount of
> connections the clients will have to maintain, to actually effectively use
> memcached. Although with current client libraries and smart use of
> memcached, that may well be in the high thousands.

Yes, it is more a matter of using smart clients.  But still, you are
likely to have a problem with your backend persistent storage before
you get to that point - especially if you expect to recover from any
major failure that dumps most of your cache at once.

--
   Les Mikesell
lesmikes...@gmail.com


Re: Best Architecture For DNS Round Robin + Memcached

2012-02-10 Thread Les Mikesell
On Fri, Feb 10, 2012 at 2:21 AM, Yiftach Shoolman
 wrote:
>
>> This makes absolutely no sense at all. If you have two servers and put a
>> webserver and memcached on both, then *half* of all cache requests will be
>> served by localhost and cause no network I/O, and half will go over the
>> network. But if you put a webserver on one and memcached on the other, then
>> *all* cache requests will be over the network, thus doubling the amount of
>> network I/O for the same amount of web requests.
>
>
> TIf you but the Memcached on a dedicated server each webserver only deals
> with the network I/O associated with its traffic, leaving the dedicated
> Memcached server to deal with all cached traffic.

Normally you would have separate front/back end networks for web and
internal traffic especially if you  are scaling to a point where
either might be saturated. There should be little conflict.

> To clear it more, if you have N servers each deployed with a webservers a
> memcached server, and memcached is distributed across all servers,   each
> webservers needs to deal with Memcached network I/O associated with N-1
> webservers --> we found it architecturally wrong, it actually slows down the
> entire application

If you have one memcached server and it goes down, you lose 100% of
your caching.

-- 
   Les Mikesell
   lesmikes...@gmail.com


Re: Issue 256 in memcached: PLEASE do not remove cachedump, better dumping feature needed

2012-02-26 Thread Les Mikesell
On Sun, Feb 26, 2012 at 10:51 AM, Slawomir Pryczek  wrote:
>
> Easiest thing would be probably just increase the LRU keys scanned to
> eg. 10k but it'll probably just kill the server :)

How do you analyze the data to decide what should be kept?   Would it
help to just use a shorter expire time on everything since it is being
evicted anyway, then write back anything you are actively reusing to
bump up the time to live?  That way less active data gets out of the
way sooner with no extra work.

-- 
  Les Mikesell
lesmikes...@gmail.com


Re: Storage Engines?

2012-07-05 Thread Les Mikesell
On Thu, Jul 5, 2012 at 5:00 PM, Brian Moon  wrote:
> I have tried running cluster. It is not a simple system to run. It requires
> a lot of hand holding.
>

So you want a multi-node db with replication that is as fast as a
cache, simple to run, and doesn't have a company supporting it?  I
suppose you want it to be reliable too.

-- 
   Les Mikesell
 lesmikes...@gmail.com


Re: Storage Engines?

2012-07-06 Thread Les Mikesell
On Thu, Jul 5, 2012 at 7:01 PM, Brian Moon  wrote:
> I just want it all! Is that too much to ask!

Expecting binary client support, not only in the language of your
choice but packaged in the extension mode of your choice seems a
little much...   Is riak over http really a big problem for you?

-- 
  Les Mikesell
lesmikes...@gmail.com


Re: Storage Engines?

2012-07-06 Thread Les Mikesell
On Fri, Jul 6, 2012 at 10:49 AM, Brian Moon  wrote:
>
> Hmm, memcached has it. Redis has it. If you want your product to be used
> seriously by the PHP community, that is the only way to go. Native PHP +
> HTTP is just not an option.

But the free product you want probably wouldn't have any reason to
care if it is taken seriously or not...

> HTTP is a horrible transport for speed.
> Especially when implemented using cURL libs in PHP code. I need
> sub-millisecond connect times and would prefer persistent connections. Riak
> over HTTP does not give me either. I know the cURL overhead. Its 2ms just
> for making the objects and creating the connections.

I think riak is pedantically correct about http 1.1, so persistent
connections should work fine.  And if you need to the speed to
assemble a lot of separate values, you might get the db to do that for
you via link walking, secondary indexes, etc.

-- 
  Les Mikesell
 lesmikes...@gmail.com


Re: Open Source NoSQL ORM(ish)

2012-07-24 Thread Les Mikesell
On Mon, Jul 23, 2012 at 9:19 PM, Evan Buswell
 wrote:
>
> Lot's of examples in the docs.  But yeah; maybe I should add a quick
> complete example to the front page?  I'll do this soon.

Did I miss where you describe the language(s) it supports?

-- 
   Les Mikesell
 lesmikes...@gmail.com


Re: Volume memcached can handle

2012-09-21 Thread Les Mikesell
On Fri, Sep 21, 2012 at 12:55 PM, Howard Chu  wrote:
>
 An "in-memory database" would have the same limits as memcached -
> both are limited to the size of physical RAM.

But the main point of memcache is that it is designed to be spread
over multiple servers.  So you are only limited by the number of
servers you want to throw into the pool.

-- 
  Les Mikesell
 lesmikes...@gmail.com


Re: Is it posible that two Seperate Instances of Memcache communicate with each other

2012-10-09 Thread Les Mikesell
On Tue, Oct 9, 2012 at 8:59 AM, Kiran Kumar  wrote:
> Thanks , let me explain my architecture more clearly
>
>  you misunderstand how memcached works. It doesn't front-end the
>  database servers like you think it does. It works like this:
>
>  Memcache1   Memcache2
>   \   /
>\ /
> \   /
>  \ /
>   \   /
>\ /
> MySQL Master
> MySQL Slave
>
>  There is NO replication between Memcache1 and Memcache2 because they
>  do not cache the same data. Memcache1 caches 50% of the data and
>  Memcache2 caches the other 50% of the data. There is no data overlap
>  so no synchronization is necessary.
>
>  If either memcached server fails, the application requesting the data
>  should "fall through" and hit the database server(s) directly.
>
>  Do you understand now?

That description is correct, but it doesn't explain why your 2
applications wouldn't work the way you want in this configuration or
why you would want separate independent servers for each application.
 Being able to distribute the cache over multiple servers is the main
reason people would use memcache.

-- 
   Les Mikesell
  lesmikes...@gmail.com


Re: Memcache : Two Seperate Memcache's instances in sync for a single application

2012-10-11 Thread Les Mikesell
On Thu, Oct 11, 2012 at 10:15 AM, Kiran Kumar  wrote:
> Thanks  rspadim , it was a mistake from my end  i have edited the question .
>
> One of the class in  Application  writes to both the instances of Memcache .

It is still not clear why you need this.   A more typical use of
memcache would be to have enough members in a single cluster that the
backend database can survive if you temporarily lose one or two of the
cache members and some percentage of queries hit it directly.

-- 
   Les Mikesell
 lesmikes...@gmail.com


Re: Is the term Replication and clustering are different with respect to 2 instances of Memcache for the same application .

2012-10-12 Thread Les Mikesell
On Fri, Oct 12, 2012 at 9:18 AM, Kiran Kumar  wrote:
> I have written a sample application as shown
>
> String location = "localhost:11211,122.34.5:11211";
> MemcachedClientBuilder builder = new
> XMemcachedClientBuilder(AddrUtil.getAddressMap(location));
> mcc.set("a", 0, "Hello,xmemcached");
>
>
> Now i have memcache installed on both the IP addresses defined above . and i
> observed that if the local host server is down , data is fetched from the
> 2nd defined server .
>
> Please let me know , is there any difference between the Clustering and
> Replication here ??
>
> And i see a lot of buzz on using Repcached with memcached for replication
> purpose , please let me know if i am missing something regarding the
> difference between clustering and memcache ??
>
> Being a newbie to memcache , Plese correct me if i am wrong .

First, note that memcache is intended to be used only as a cache in
front of a slower but reliable data store where on a cache miss, the
client will pull the data from the backend store and refresh it in the
cache. Memcache itself does not do any replication, although you may
see 3rd party tools that attempt to keep redundant copies of the data.
 What is supposed to happen is that if a client notices that one of
the configured severs is down it will adjust its hashing to evenly
spread the keys over the remaining set.  Then the first cache miss
will update it in the new still-working location so other than having
a smaller capacity and possibly evicting things sooner, things
continue normally.   Alternatively you can use a hash computation that
doesn't change and just always fail on the portion of the keyspace
that the failing server handles until it comes back.  With a large
number of memcache servers, this results in a small percentage of
requests always hitting the data store directly when a cache server is
down, but avoids the chance of inconsistency if the clients notice the
outage/recovery at slightly different times.

-- 
   Les Mikesell
 lesmikes...@gmail.com


Re: Is the term Replication and clustering are different with respect to 2 instances of Memcache for the same application .

2012-10-12 Thread Les Mikesell
On Fri, Oct 12, 2012 at 11:00 AM, Kiran Kumar  wrote:
>
> Could you please check this link
> https://groups.google.com/forum/#!topic/memcached/YCKNM6wRTbk where the
> author is saying that if you maintain two instances of servers in the list ,
> the Data will be automatically backed up to the other server also , is
> thisn't clustering ??

I don't see anything about data being 'backed up' in that link.  It
says that if you add a new server instance the clients will fill it in
as the key hashing is adjusted to spread across the servers and they
refresh cache misses as they pull them from the backend data store.
They seem to be talking about running another memcached instance on
the same server but a different port, but that doesn't make any
difference to the client.

-- 
   Les Mikesell
lesmikes...@gmail.com


Re: Is the term Replication and clustering are different with respect to 2 instances of Memcache for the same application .

2012-10-12 Thread Les Mikesell
On Fri, Oct 12, 2012 at 11:31 AM, Kiran Kumar  wrote:
>
> Thanks LesMikesell you were right there is nothing mentioned anything
> about data being backed up in that link .
> What i really want to convery is that if one of the Memcahe  Server one is
> is down , then automatically Data is being obtained from Memcahe  Server two
> , which avoids  single point of failure . so i don't care if Data is being
> obtained from any of the defined servers .
>
> ( that is  what i mean to say data being copied to other location , i
> sincerely if it creates a different meaning in this context )
>
> (becuase as a end user i don't bother from which the data is being
> obtained )

Memcache should only be used for fast repeated access to _copies_ of
data that can be reliably retrieved from some other database or
storage.   There are any number of reasons why a server will not have
the data a client requests (it expired, it was evicted due to lack of
space, the server was restarted, etc.).   The client's response to a
cache miss should always be to get the data from the reliable database
and update it into the cache.  So it won't matter if any particular
data is lost for any particular reason as long as the backend database
can keep up with the clients requesting the missed data (which they
will then refresh into a rebalanced hash location).If you are
planning to use memcache to store the only copy of data that you can't
reconstruct, you should be looking for some other product.  Memcache
is just a very fast distributed cache, not a reliable database.  But
as long as you can retrieve the data for cache misses from some other
source you can just add more servers to a cluster to scale to any
size, and other than having to configure each client to know about all
the servers it will take care of itself.

-- 
   Les Mikesell
  lesmikes...@gmail.com


Re: Is the term Replication and clustering are different with respect to 2 instances of Memcache for the same application .

2012-10-12 Thread Les Mikesell
On Fri, Oct 12, 2012 at 1:16 PM, Kiran Kumar  wrote:
> Thanks LesMikesell,for the great explanation , i am helpless here , i am
> working on a existing application , which is designed in such a way that all
> the Data is written to Memcache (and there is no Database at all ) which is
> the only data store currently , so what i was asking is that, will
> clustering of Memcache  Servers will avoid single point of failure ??

It will not avoid losing the values currently in the cache.  If that
matters, memcache is not what you should be using to store it.
Clustering avoids a single point of failure in the sense that the hash
re-balancing continues to provide the clients a place to cache freshly
obtained data.

-- 
   Les Mikesell
  lesmikes...@gmail.com


Re: Is the term Replication and clustering are different with respect to 2 instances of Memcache for the same application .

2012-10-12 Thread Les Mikesell
On Fri, Oct 12, 2012 at 2:03 PM, Kiran Kumar  wrote:
> Will replication of Memcache servers can solve the problem of not losing the
> data ??

Not in an absolute sense.  That is, there are still other reasons data
might be evicted, and nothing in memcache is going to provide
replication - it is just not what it is designed for.   And if your
whole site loses power, it will be gone anyway.

Having said that, there are other people with the same problem.
http://www.couchbase.com/couchbase-server/overview might work ( I
haven't tried it, so that's not a recommendation - just something that
looks like it will it will work with the same clients but attempts to
provide reliable storage).  There have been other similar attempts,
but I haven't followed their current status.

-- 
   Les Mikesell
 lesmikes...@gmail.com


Re: Is the term Replication and clustering are different with respect to 2 instances of Memcache for the same application .

2012-10-12 Thread Les Mikesell
On Fri, Oct 12, 2012 at 2:50 PM, Kiran Kumar  wrote:
> Thanks LesMikesell ,
>
> I was searching for Data replication Option with xMemcahced library , what i
> found is that Data replication with xmemcache is possible by using repcached
> , please see this link
>
> https://groups.google.com/forum/#!msg/xmemcached/4LezU1A7ldU/OpXD_uEHDgAJ
>
> and let me know is that dependable to go with  ??  can i use repcache with
> Memcache on Java application .
>

I don't know anything about repcached.  It might work, but if you need
reliable storage I'd recommend using something that is designed to
provide reliable storage instead of just using something designed to
be a cache even with multiple instances.

-- 
Les Mikesell
  lesmikes...@gmail.com


Re: Questions about memcached in general and failover

2012-10-16 Thread Les Mikesell
On Tue, Oct 16, 2012 at 11:22 AM, Kiran Kumar  wrote:
>
> Memcache doesn't automatically comes with Replication facility (High
> Avialibility) , i recomend you to use Repcache Patch on top of your existing
> mecached for obtaining Replication of data
>  within your servers .
>
> The only issue i see is that Repcached only works / Successfully Worked when
> there are only two servers two replicate .

If you are going to be stuck with this restriction - and have to build
your own fail-over, is there any advantage to using memcache compared
to redis with its much larger feature set?

-- 
   Les Mikesell
  lesmikes...@gmail.comi


Re: data synchronization betwean memcached cluster nodes?

2012-10-17 Thread Les Mikesell
On Wed, Oct 17, 2012 at 12:25 AM, Raymond Wang  wrote:
> I am newbie to Memcached, and I have  a questions about cluster deployment:
>
> does memcached support data synchronization betwean cluster nodes? if it
> does, how can I determine the scope of synchronization?

No, the keys are distributed over the cluster nodes and if data is not
found in the cache it is up to the client to pull a new copy from the
persistent data store and refresh it in the cache.

-- 
   Les Mikesell
lesmikes...@gmail.com


Re: Behavior of Memcached Client during Replication Process

2012-10-17 Thread Les Mikesell
On Wed, Oct 17, 2012 at 11:24 AM, Kiran Kumar  wrote:
> Hi ,
>
> We are  using Memcache in a different/wrong  way , that is Memcache as a
> Complete Data Store itself .
>
> The setup of our Application  is in such a way that , there are two Memcache
> servers (Server1 and Server2 )where  both of them acting as active  active
> (Master - Master  ) each of them gets unique store of Data ,  and  finally
> repcached is applied  on top of these severs for providing  replication  .
>
> The Data is being replicated bethween these two  servers and i observed that
> there is a small delay regarding the two servers being in  sync with each
> other
>
> I am using Xmemcached 1.4 version as Memcache Client .
>
> I have these two questions with respect to the above set up of our
> Application .
>
> 1. Is the XMemcached Client Smart enough to read Key from   Server2 ,
> incase   it can't  find that key in Sever 1 ( As i mentioned that there is a
> small delay till both the servers are in synch with each other )
>
> 2.  Incase i  configure my Memcache client to use
> KetamaMemcachedSessionLocator inside the code , will this be of  any help
> with respect to the above scenario ??
>

There should be options for how the client handles a server failure:
http://code.google.com/p/xmemcached/wiki/FailureMode_StandbyNode

Failure doesn't mean 'key doesn't exist', though, it means 'server
connection fails'.

-- 
   Les Mikesell
 lesmikes...@gmail.com


Re: Behavior of Memcached Client during Replication Process

2012-10-17 Thread Les Mikesell
On Wed, Oct 17, 2012 at 1:56 PM, Kiran Kumar  wrote:
> Les Mikesell , Thanks for the link , but unfortunately that is no where
> related to my question above .
> anyway once again , What i was asking is that as there is some delay in Data
> Replication , will the Memcache Client checks server2  also  in case if it
> doesn't found in Server 1 .

No, I can't imagine any circumstance where a memcache client would
consider a key that doesn't exist in its expected location to be a
server error.  Why should it?I think the only way you can get that
effect is to define only one server.  All clients using the same
hashing should store/retrieve it on the same target as the first
choice anyway with the only reason to retry being if one is down - but
that leaves you without a good way to handle the situation where the
down instance is restarted and its cache is empty.

-- 
   Les Mikesell
 lesmikes...@gmail.com


Re: Memcached and repcached not replicating 2 master servers

2012-10-22 Thread Les Mikesell
On Mon, Oct 22, 2012 at 2:41 PM, Kiran Kumar  wrote:
> Hi ,
>
>  I have memcached-14.5 and -repcached-2.2 installed on memcached on ubuntu.
> They install went great and when i start memcached i get: replication:
> connect (peer=server1:11212) replication: marugoto copying replication:
> close replication: listen This looks good and for testing purpose i set in a
> Server 1
>
> set my_key 0 2592000 1
> 5
>
> and was able to get this in Server 2 . All this works fine .
>
> But my question / issue is that , when i set the Data through MemcacheClient
> , the data is not being properly replicated (Means sometimes the Data is
> reflected and sometimes not )
>
> String location = server1:11211 server2:11211
> MemcachedClientBuilder builder = new
> XMemcachedClientBuilder(AddrUtil.getAddressMap(location));
> builder.setSessionLocator(new KetamaMemcachedSessionLocator(true));
>
>
> Please let me know if i need to set anything more to make it work ??

If the memcache client knows about 2 servers it will send half to one
and half to the other based on the key hashing.  Does repcached
replicate both directions?   In any case this sounds like an issue
with repcached so not something that most people on this list would
know.

-- 
   Les Mikesell
 lesmikes...@gmail.com


Re: How to solve atomic operation issue within two instances of Memcache Servers

2012-10-25 Thread Les Mikesell
On Thu, Oct 25, 2012 at 5:38 AM, Henrik Schröder  wrote:
> No, you can't solve this problem as long as you keep insisting on your weird
> setup.

Yes, distributed locking for atomic operations is an extremely
difficult problem to solve - perhaps not even possible to do correctly
with  just 2 hosts where you can't get a quorum if they lose network
contact.

> If you absolutely must have some sort of replicated datastore, memcached is
> the wrong choice, you'd be much better off looking at *actual* replicated
> datastores, such as HBase or MongoDB.

Or, if you need to keep the memcache client, maybe couchbase would
work on the server side:
http://www.couchbase.com/membase

-- 
  Les Mikesell
 lesmikes...@gmail.com


Re: Stale data handling with memcached/consistent hashing

2012-12-25 Thread Les Mikesell
On Tue, Dec 25, 2012 at 5:03 AM, howard chen  wrote:
>
>> Assuming you're doing some cloud use case where you're frequently
>> adding/removing servers? Most memcached server lists should stay fairly
>> static.
>
>
> Yes, the  server lists should be static most of the time, but we need to do
> VMs housekeeping from time to time. We are looking for elegant way to handle
> stale cache without the need of flush data every-time when we updated the
> server lists.

Can't you find a reasonable expire time that won't overload your
backend data store and also won't  go too long with old data?

-- 
   Les Mikesell
 lesmikes...@gmail.com


Re: DB support

2013-09-24 Thread Les Mikesell
On Tue, Sep 24, 2013 at 3:16 AM, Namita Nair  wrote:
> Hi All,
>
> I mean does the memcache automatically load the data if not found in the
> cache through some configuration like the one present in the hazelcast and
> oracle coherence.
>

It is up to the client to obtain/load the data when it is not already
current in the cache.  There may be some clients embedded in database
or database-like packages, but in general your client can use any
persistent data store along with memcache.

-- 
   Les Mikesell
  lesmikes...@gmail.com

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Thousands of CLOSE_WAIT connections

2013-09-30 Thread Les Mikesell
On Mon, Sep 30, 2013 at 10:36 AM, Nic Jansma  wrote:
> ...
>
> The rest of the connections are in FIN_WAIT1, ESTABLISHED, etc, but the vast
> majority are the ~4,000 CLOSE_WAIT connections.
>
> I'm going to try bumping up the connection limit to 32k to avoid this for
> now, but clearly there's something going on where memcached isn't closing
> connections.

That sounds like your client is opening persistent connections but not
reusing them.

-- 
   Les Mikesell
  lesmikes...@gmail.com

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Thousands of CLOSE_WAIT connections

2013-09-30 Thread Les Mikesell
On Mon, Sep 30, 2013 at 11:44 AM, Nic Jansma  wrote:
>
> On Monday, September 30, 2013 12:23:42 PM UTC-4, LesMikesell wrote:
>>
>> That sounds like your client is opening persistent connections but not
>> reusing them.
>
>
> Doesn't the CLOSE_WAIT state indicate that the client has sent a FIN and yet
> memcached hasn't internally closed/cleaned up the connection?
>
> I don't fully understand how pecl memcache/memcached's persistent
> connections feature uses the socket, but I don't imagine they would send a
> FIN then still try to re-use the connection later.

Yes, I guess I had it backwards.  CLOSE_WAIT should mean the other end
has sent the FIN and is done sending.  The server still needs to send
the requested data before closing its side - maybe the client isn't
reading fast enough and the tcp window is full at this point.

-- 
   Les Mikesell
 lesmikes...@gmail.com

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Thousands of CLOSE_WAIT connections

2013-10-03 Thread Les Mikesell
On Thu, Oct 3, 2013 at 4:50 PM, Nic Jansma  wrote:
> I don't think the problem is caused by the PHP extension at this point,
> since having the sockets in a CLOSE_WAIT state is most likely indicative of
> something in the memcached server not closing the connection after it gets a
> FIN.
>
The send/receive sides of a socket are closed separately.  The
client's FIN means it isn't going to send any more.  That's almost
unrelated to the server having to finish sending the requested data
before closing it's side.   It can very well be that the client isn't
reading the response it requested and your tcp window is full as the
server tries to send.

> I've been monitoring memcached over the past few days, and it normally
> doesn't get in this state.  i.e. I don't normally see ANY CLOSE_WAIT
> connections open.
>
> However, when it starts not responding to connection requests, it appears to
> be in this state where there's thousands of CLOSE_WAIT connections.

You have a finite number of sockets.

> Does anyone have suggestions for how I can debug this further?  Memcached is
> not being production-ready reliable for me right now (including the weekly
> crash listed in the original post, which may or may not be related).

Lots of people are using various versions of the server in production.
  Can you try to reproduce the behavior with some other client or
benchmark/load test tool?   My guess is that it is something unrelated
in the code calling the client library that can cause it to request
but not consume the response.

-- 
   Les Mikesell
 lesmikes...@gmail.com

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problems when one of the memcached server down

2013-10-17 Thread Les Mikesell
On Thu, Oct 17, 2013 at 1:08 AM, SivaRam M  wrote:
>
> Apologies for intervening here. I'm using memcahce-php client and there is
> this call called getstats() which returns stats of a server if it is up an
> runnig
> and returns false if there is something really bad happens to server.
> My question is while hashing the key to a particular server . Will our
> consistent hash function consider this failed server .
> I just want to know what backup plans are available if a server is down.

The backup plan should always be for the client to fetch the data from
a persistent store on any cache miss. I may have this backwards, but I
think the clients with consistent hashing will keep the same hash
regardless of the server state and continue to have hash misses for
whatever percentage of servers are down at any time.   Ones that don't
have consistent hashing will adjust the ring to the number of working
servers, losing some current data but letting the clients update it in
the new location on the first access.   Obviously, the more servers
you use the less the impact of losing one will be.

-- 
   Les Mikesell
 lesmikes...@gmail.com

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problem regards Storing files inside Memcached server?

2013-10-17 Thread Les Mikesell
On Thu, Oct 17, 2013 at 8:58 AM, sekhar mekala  wrote:
> HI,
>
> I having an input file(.JSON,.jpg,.txt,etc..).That file i need to store into
> memcached server.
> I don't want to convert file to byte[] before passing to memcached server.
> If any possibility to store file inside Memcached server?
> I am using spymemcached tool.
>
> Example:
>
> MemcachedClient mc=new MemcachedClient(new
> InetSocketAddress("192.168.7.104",11211));
> File file=new File("D:\\test.txt");
> mc.set("Key1",3600,file);
> mc.get("Key1");
>

Memcache doesn't care about the content of what you set/get.  If your
question is about the size, the default limit is 1MB so you either
need to chunk up the data for bigger files or use the -l option to
raise the size limit (which is allowed but perhaps not a good idea).

-- 
   Les Mikesell
 lesmikes...@gmail.com

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Memcached cluster

2014-03-03 Thread Les Mikesell
On Mon, Mar 3, 2014 at 6:01 AM, Ranjit D'Souza  wrote:
> I have a basic question:
>
> Does memcached support clustering and HA out of the box, or does it need
> some third party integration in order to do so?

Yes, but it is a cache, not a persistent store so the way it handles
failure of a node is for the client to fetch a new copy of the cache
misses from the backing storage.

-- 
   Les Mikesell
 lesmikes...@gmail.com

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Memcached cluster

2014-03-03 Thread Les Mikesell
On Mon, Mar 3, 2014 at 11:36 PM, Ranjit D'Souza  wrote:
> Thank you
>
> Is there any concept of master-slave configuration (like in Redis), and
> promoting the slave to master?

No, the server nodes are all alike and don't need to know about each
other.  The clients need to know about all the servers and they
distribute the data by hashing the keys.  Depending on the hashing
scheme the clients can rebalance the distribution when a node fails
(invalidating some existing data) or continue to fail and use the
backing store for the missing percentage until the node is back on
line.

> Can you point me to a document or wiki link that gives more information on
> how to set up a memcached cluster?

The server side is packaged for some Linux distributions.  You just
configure the amount of memory for it to use on each node.

-- 
  Les Mikesell
 lesmikes...@gmail.com

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Memcached cluster

2014-03-04 Thread Les Mikesell
On Tue, Mar 4, 2014 at 2:56 AM, Ranjit D'Souza  wrote:
>
> Thanks guys, this is quite helpful
>
> In the same vein, can we also say that memcache replication is also a client
> side driven solution?

In the stock system, there is no replication - although I believe
others done it with client code.   If you have a large enough number
of servers, losing one will just add a small percentage of extra load
on your backend DB to cover the extra cache misses.

-- 
  Les Mikesell
 lesmikes...@gmail.com

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Idea for reclaimation algo

2014-04-11 Thread Les Mikesell
On Fri, Apr 11, 2014 at 3:47 AM, Slawomir Pryczek  wrote:
>
> When using memcached as a buffer for mysql writes, we know exactly what to
> hit and when. Short TTL expired items, pile up near the head... long TTL
> "live" items pile up near the tail and it's creating a barrier that prevents
> the LRU algo to reclaim almost anything, if im getting how it currently
> works, correctly...

Are you saying that within the same slab, non-expired items are
evicted instead of available expired items?  Are you sure you aren't
just targeting different slabs because of the item size?

-- 
  Les Mikesell
lesmikes...@gmail.com

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1   2   >