I am seeing something that struck me as a little odd.
From my reading, as I understand, in a memcached environment, each memcache node contains a portion of the objects in the cluster.
Each node is holding ~9 keys/objects.... is that correct to assume?
3) Collect all the info.
It seems to me, that I am getting the same keys listed on all 3 servers..... ?
I did not expect this, and I am hoping someone can explain.
List<string> ret = new List<string>();
string memCacheEndPointAddress = Config.GetValueWithDefault("MemCached.Endpoint", "localhost:11211");
string[] points = memCacheEndPointAddress.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string h in points)
{
string[] hParts = h.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
string cacheHost = hParts[0];
TelNetConn tc = new TelNetConn(cacheHost, Convert.ToInt32(hParts[1]));
if (tc.IsConnected)
{
ret.Add("HOST: " + cacheHost);
tc.WriteLine("stats items");
String s = tc.Read();
String[] sLines = s.Split(
new string[] { Environment.NewLine },
StringSplitOptions.RemoveEmptyEntries);
foreach (string sl in sLines)
{
if (sl == "END") continue;
String[] slParts = sl.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
int slabID = Convert.ToInt32(slParts[1]);
string slabType = slParts[2];
if (slabType.StartsWith("number") || slabType.StartsWith("age"))
{
tc.WriteLine("stats cachedump " + slabID + " 100");
s = tc.Read();
if (!String.IsNullOrEmpty(s))
{
if (s != "END")
{
// ret.Add("FULL: " + s);
if (s.StartsWith("ITEM "))
{
string[] itemparts = s.Split(new[] { ' ' }, StringSplitOptions.None);
string key = itemparts[1];
ret.Add("ITEM: " + key);
}
}
}
}
}
}
else
{
ret.Add("HOST: " + cacheHost + " NOT CONNECTED");
}
tc.Dispose();
}