Is it possible to get Memcached Key from a Specific Server during 2 instances of Memcache setup .

2012-10-27 Thread Kiran Kumar
Hi , 

I have Two  Memcache Servers set up for my Application as shown below 

String location = 10.1.1.1:11211 10.1.1.2:11211;
MemcachedClientBuilder builder = new 
XMemcachedClientBuilder(AddrUtil.getAddresses(location));

During the Memcache clinet operation ,  Key can be stored in any one of the 
Sever Mentioned above .

When i observed the logs , the Setup is showing two Memcache Servers 
recognized  , i verified with the below code .



CollectionInetSocketAddress addressList = 
MemcachedClient.getAvaliableServers();
for (InetSocketAddress address : addressList) {
logger.error(THE address is+address)
}


THE address is 10.1.1.1
THE address is 10.1.1.2




My question is , once i knew the Server IP and port , is Is it possible get 
the Key based on the Server ??

Means something like this i need 

MemcachedClinet.getKey(MyKEY) // from server 1 
MemcachedClinet.getKey(MyKEY) // from server 2 


Please let me know if this is possible ??




Re: Is it possible to get Memcached Key from a Specific Server during 2 instances of Memcache setup .

2012-10-27 Thread dormando
Hi!

I really hate to do this, but you're really off topic. You've been
selectively accepting advice from the mailing list for weeks now, and
making thread after thread.

You have only vaguely stated your project requirements.

You have ignored the want (or need) to actually properly test your own
application.

You seem insistant on bending memcached into your requirements.

You've said:

1) I want two servers to scale memcached.

2) I need two servers for redundancy.

You don't need two servers to scale memcached. I've tried to explain this
before. Memcached is going to be faster than your application.

If losing a memcached instance causes data loss, DO NOT USE IT. I cannot
emphasize this enough. There are reasons upon reasons why memcached does
not work the way you want it to, and you seem to be slowly finding out all
of these cases for yourself.

Please stop wasting our time. If you continue to ignore the community's
help, I'm just going to have to block you from the mailing list. We've
given you a lot of solid advice and I'm afraid you're going to discourage
people by asking more questions. If you have questions along the lines of
what people are saying to you, please address them directly instead of
ignoring them and asking more off-topic questions.

Thanks, and my apologies,
-Dormando

On Sat, 27 Oct 2012, Kiran Kumar wrote:

 Hi , 

 I have Two  Memcache Servers set up for my Application as shown below 

 String location = 10.1.1.1:11211 10.1.1.2:11211;
 MemcachedClientBuilder builder = new 
 XMemcachedClientBuilder(AddrUtil.getAddresses(location));

 During the Memcache clinet operation ,  Key can be stored in any one of the 
 Sever Mentioned above .

 When i observed the logs , the Setup is showing two Memcache Servers 
 recognized  , i verified with the below code .



 CollectionInetSocketAddress addressList = 
 MemcachedClient.getAvaliableServers();
 for (InetSocketAddress address : addressList) {
 logger.error(THE address is+address)
 }


 THE address is 10.1.1.1
 THE address is 10.1.1.2




 My question is , once i knew the Server IP and port , is Is it possible get 
 the Key based on the Server ??

 Means something like this i need 

 MemcachedClinet.getKey(MyKEY) // from server 1 
 MemcachedClinet.getKey(MyKEY) // from server 2 


 Please let me know if this is possible ??






Re: Is it possible to get Memcached Key from a Specific Server during 2 instances of Memcache setup .

2012-10-27 Thread Kiran Kumar
Hi , 

It seems that you are quite upset with my postings .
I am asking because i am working on a existing architecture , and i need to 
follow the things as per now .

On Saturday, 27 October 2012 13:47:40 UTC+5:30, Dormando wrote:

 Hi! 

 I really hate to do this, but you're really off topic. You've been 
 selectively accepting advice from the mailing list for weeks now, and 
 making thread after thread. 

 You have only vaguely stated your project requirements. 

 You have ignored the want (or need) to actually properly test your own 
 application. 

 You seem insistant on bending memcached into your requirements. 

 You've said: 

 1) I want two servers to scale memcached. 

 2) I need two servers for redundancy. 

 You don't need two servers to scale memcached. I've tried to explain this 
 before. Memcached is going to be faster than your application. 

 If losing a memcached instance causes data loss, DO NOT USE IT. I cannot 
 emphasize this enough. There are reasons upon reasons why memcached does 
 not work the way you want it to, and you seem to be slowly finding out all 
 of these cases for yourself. 

 Please stop wasting our time. If you continue to ignore the community's 
 help, I'm just going to have to block you from the mailing list. We've 
 given you a lot of solid advice and I'm afraid you're going to discourage 
 people by asking more questions. If you have questions along the lines of 
 what people are saying to you, please address them directly instead of 
 ignoring them and asking more off-topic questions. 

 Thanks, and my apologies, 
 -Dormando 

 On Sat, 27 Oct 2012, Kiran Kumar wrote: 

  Hi ,  
  
  I have Two  Memcache Servers set up for my Application as shown below  
  
  String location = 10.1.1.1:11211 10.1.1.2:11211; 
  MemcachedClientBuilder builder = new 
 XMemcachedClientBuilder(AddrUtil.getAddresses(location)); 
  
  During the Memcache clinet operation ,  Key can be stored in any one of 
 the Sever Mentioned above . 
  
  When i observed the logs , the Setup is showing two Memcache Servers 
 recognized  , i verified with the below code . 
  
  
  
  CollectionInetSocketAddress addressList = 
 MemcachedClient.getAvaliableServers(); 
  for (InetSocketAddress address : addressList) { 
  logger.error(THE address is+address) 
  } 
  
  
  THE address is 10.1.1.1 
  THE address is 10.1.1.2 
  
  
  
  
  My question is , once i knew the Server IP and port , is Is it possible 
 get the Key based on the Server ?? 
  
  Means something like this i need  
  
  MemcachedClinet.getKey(MyKEY) // from server 1  
  MemcachedClinet.getKey(MyKEY) // from server 2  
  
  
  Please let me know if this is possible ?? 
  
  
  
 



Re: Is it possible to get Memcached Key from a Specific Server during 2 instances of Memcache setup .

2012-10-27 Thread Henrik Schröder
There are no answers to your questions, because that architecture is wrong,
memcached is the wrong tool for the job, and what you want to achieve
cannot be done.

Memcached is a distributed cache, but your existing architecture seems to
treat it as a distributed replicated datastore, and memcached is not one of
those and cannot work as such. You have to replace it with one of those.
There are plenty to choose from:
http://en.wikipedia.org/wiki/Distributed_data_store


/Henrik

On Sat, Oct 27, 2012 at 10:29 AM, Kiran Kumar krn1...@gmail.com wrote:

 Hi ,

 It seems that you are quite upset with my postings .
 I am asking because i am working on a existing architecture , and i need
 to follow the things as per now .


 On Saturday, 27 October 2012 13:47:40 UTC+5:30, Dormando wrote:

 Hi!

 I really hate to do this, but you're really off topic. You've been
 selectively accepting advice from the mailing list for weeks now, and
 making thread after thread.

 You have only vaguely stated your project requirements.

 You have ignored the want (or need) to actually properly test your own
 application.

 You seem insistant on bending memcached into your requirements.

 You've said:

 1) I want two servers to scale memcached.

 2) I need two servers for redundancy.

 You don't need two servers to scale memcached. I've tried to explain this
 before. Memcached is going to be faster than your application.

 If losing a memcached instance causes data loss, DO NOT USE IT. I cannot
 emphasize this enough. There are reasons upon reasons why memcached does
 not work the way you want it to, and you seem to be slowly finding out
 all
 of these cases for yourself.

 Please stop wasting our time. If you continue to ignore the community's
 help, I'm just going to have to block you from the mailing list. We've
 given you a lot of solid advice and I'm afraid you're going to discourage
 people by asking more questions. If you have questions along the lines of
 what people are saying to you, please address them directly instead of
 ignoring them and asking more off-topic questions.

 Thanks, and my apologies,
 -Dormando

 On Sat, 27 Oct 2012, Kiran Kumar wrote:

  Hi ,
 
  I have Two  Memcache Servers set up for my Application as shown below
 
  String location = 10.1.1.1:11211 10.1.1.2:11211;
  MemcachedClientBuilder builder = new XMemcachedClientBuilder(**
 AddrUtil.getAddresses(**location));
 
  During the Memcache clinet operation ,  Key can be stored in any one of
 the Sever Mentioned above .
 
  When i observed the logs , the Setup is showing two Memcache Servers
 recognized  , i verified with the below code .
 
 
 
  CollectionInetSocketAddress addressList = 
  MemcachedClient.**getAvaliableServers();

  for (InetSocketAddress address : addressList) {
  logger.error(THE address is+address)
  }
 
 
  THE address is 10.1.1.1
  THE address is 10.1.1.2
 
 
 
 
  My question is , once i knew the Server IP and port , is Is it possible
 get the Key based on the Server ??
 
  Means something like this i need
 
  MemcachedClinet.getKey(MyKEY**) // from server 1
  MemcachedClinet.getKey(MyKEY**) // from server 2
 
 
  Please let me know if this is possible ??
 
 
 
 




How is it possible to locate server based on key hash code

2012-10-27 Thread Ravi
I have 3 Memcached balanced Servers running for the Application .

I googled and found out that , using hashkey , its possible to locate a key 
from any of the server 

I am using KetamaMemcachedSessionLocator set up with my code .


I tried this way , but i am not sure if its correct or not .

int mod = MemcachedClient.getAvailableServers().size(); // This value is 3 

int keyid = key.hashCode();


COuld anybody please tell me how can i locate first , Second Server  with 
this approach ??



Re: Is it possible to get Memcached Key from a Specific Server during 2 instances of Memcache setup .

2012-10-27 Thread dormando
This is exactly the stubbornness I'm talking about.

I don't care why you think you need to shoehorn the damn thing. We've been
telling you how it works and you're ignoring us. Stop begging people to do
your damn work for you.

And did you just use another account to post the same question again?
That's fairly immature.

On Sat, 27 Oct 2012, Kiran Kumar wrote:

 Hi , 
 It seems that you are quite upset with my postings .
 I am asking because i am working on a existing architecture , and i need to 
 follow the things as per now .

 On Saturday, 27 October 2012 13:47:40 UTC+5:30, Dormando wrote:
   Hi!

   I really hate to do this, but you're really off topic. You've been
   selectively accepting advice from the mailing list for weeks now, and
   making thread after thread.

   You have only vaguely stated your project requirements.

   You have ignored the want (or need) to actually properly test your own
   application.

   You seem insistant on bending memcached into your requirements.

   You've said:

   1) I want two servers to scale memcached.

   2) I need two servers for redundancy.

   You don't need two servers to scale memcached. I've tried to explain 
 this
   before. Memcached is going to be faster than your application.

   If losing a memcached instance causes data loss, DO NOT USE IT. I cannot
   emphasize this enough. There are reasons upon reasons why memcached does
   not work the way you want it to, and you seem to be slowly finding out 
 all
   of these cases for yourself.

   Please stop wasting our time. If you continue to ignore the community's
   help, I'm just going to have to block you from the mailing list. We've
   given you a lot of solid advice and I'm afraid you're going to 
 discourage
   people by asking more questions. If you have questions along the lines 
 of
   what people are saying to you, please address them directly instead of
   ignoring them and asking more off-topic questions.

   Thanks, and my apologies,
   -Dormando

   On Sat, 27 Oct 2012, Kiran Kumar wrote:

Hi , 
   
I have Two  Memcache Servers set up for my Application as shown below 
   
String location = 10.1.1.1:11211 10.1.1.2:11211;
MemcachedClientBuilder builder = new 
 XMemcachedClientBuilder(AddrUtil.getAddresses(location));
   
During the Memcache clinet operation ,  Key can be stored in any one 
 of the Sever Mentioned above .
   
When i observed the logs , the Setup is showing two Memcache Servers 
 recognized  , i verified with the below code .
   
   
   
CollectionInetSocketAddress addressList = 
 MemcachedClient.getAvaliableServers();
for (InetSocketAddress address : addressList) {
logger.error(THE address is+address)
}
   
   
THE address is 10.1.1.1
THE address is 10.1.1.2
   
   
   
   
My question is , once i knew the Server IP and port , is Is it 
 possible get the Key based on the Server ??
   
Means something like this i need 
   
MemcachedClinet.getKey(MyKEY) // from server 1 
MemcachedClinet.getKey(MyKEY) // from server 2 
   
   
Please let me know if this is possible ??
   
   
   
   





Relation between cmd_get vs get_hits and cmd_set and get_misses

2012-10-27 Thread Nevz
I started working with memcached short time ago to relive our DB from the 
stress it was inn, and i actually feel a difference and think it's a lot 
more responsive now.
But i wonder how i actually see the success rate of my efforts. I have a 
very weird patern, where it cmd_get is equal to cmd_hits and cmd set is 
equal to get_misses.
Is it not correct that get_hits + get_misses = cmd_get ?

stats
STAT pid 16758
STAT uptime 508
STAT time 1351363371
STAT version 1.4.2
STAT pointer_size 64
STAT rusage_user 0.07
STAT rusage_system 0.14
STAT curr_connections 5
STAT total_connections 1655
STAT connection_structures 9
STAT cmd_get 1312
STAT cmd_set 941
STAT cmd_flush 0
STAT get_hits 1312
STAT get_misses 941
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT bytes_read 1013175
STAT bytes_written 1283468
STAT limit_maxbytes 2147483648
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT bytes 3637
STAT curr_items 5
STAT total_items 935
STAT evictions 0
END

Typical usage is something like below. It's not built into my DB handler 
yet because i only need to use it on very few very frequently run queries.

?php
$mc = MyMemcached::getInstance();

$memcachedKey = SQL:1:FOO: . $uniqueFooIdentifier;
$foo = $mc-get($memcachedKey);

if($foo === false) {

DOES SOME SQL STUFF AND FETCH FOO FROM DB
 //Save it in memcached
//CFG_CACHE_TIMEOUT_FOO is static set to fx 15secs i also do some micro 
caching on some very frequent queries where the time is set to 1/2secs
$mc-set($memcachedKey, $foo, CFG_CACHE_TIMEOUT_FOO);
}
?

Best regards //Nevz



Re: How is it possible to locate server based on key hash code

2012-10-27 Thread David Walter
I think that you want to read how consistent hashing works, in brief,
it's not a simple modulo arithmetic mapping.

http://www.paperplanes.de/2011/12/9/the-magic-of-consistent-hashing.html

libmemcached has an option:

memcached_server_instance_st memcached_server_by_key(const memcached_st *ptr,
 const char *key,
 size_t key_length,
 memcached_return_t *error)

Your language probably has a similar method server for key or by key.


On Sat, Oct 27, 2012 at 11:47 AM, Ravi ravikiranva...@gmail.com wrote:
 I have 3 Memcached balanced Servers running for the Application .

 I googled and found out that , using hashkey , its possible to locate a key
 from any of the server

 I am using KetamaMemcachedSessionLocator set up with my code .


 I tried this way , but i am not sure if its correct or not .

 int mod = MemcachedClient.getAvailableServers().size(); // This value is 3

 int keyid = key.hashCode();


 COuld anybody please tell me how can i locate first , Second Server  with
 this approach ??



Can't find libevent - Windows

2012-10-27 Thread Navaneeth KN
Hello,

I am trying to get memcached running on Windows. I have downloaded 
memcached stable latest and compiled it using Mingw under Windows 7. 
Configure failed with error, 

checking for libevent directory... configure: error: libevent is required.  
You
can get it from http://www.monkey.org/~provos/libevent/

  If it's already installed, specify its path using 
--with-libevent=/dir/

Then I downloaded `libevent` and compiled it. This produced 3 DLLs, 
libeventcore, libevent-extra and libevent-2.0.5. 

I ran configure on memcached again with passing `--with-libevent` flag. But 
for some reason, it fails again with the same error. I have no clue on why 
it is failing. Can anyone help me to resolve this issue? I am using 
Windows7 64bit version with MinGW.

Thanks
Navaneeth