On Jan 16, 2008 9:45 AM, Ciaran <[EMAIL PROTECTED]> wrote:
> HI,
> Am I better modifying the Enyim.Memcached client to support an Async Set
> [clearly a workqueue around the normal set command] (and provide you with
> another patch), or just wrap the existing client in my own facade to provide
> this functionality, i.e. what would 'a' (Enyim) prefer.
>
>
> On the off-chance that someone's interested, the following code :
IList<IEndPoint> servers = new List<IEndPoint>();
servers.Add(new Enyim.Caching.Configuration.Code.EndPoint("
127.0.0.1", 11211));
MemCachedClientConfiguration configuration = new
MemCachedClientConfiguration(servers);
MemcachedClient client = new MemcachedClient(configuration);
DateTime before = DateTime.Now;
for (int i = 0; i < 10000; i++)
{
Guid guid = Guid.NewGuid();
client.Store(StoreMode.Set, guid.ToString(), guid);
}
DateTime after= DateTime.Now;
Console.Out.WriteLine(String.Format("Took {0}ms to do 10000
stores", ((TimeSpan)(after-before)).TotalMilliseconds));
DateTime beforeAsync = DateTime.Now;
for (int i = 0; i < 10000; i++)
{
Guid guid = Guid.NewGuid();
client.StoreAsync(StoreMode.Set, guid.ToString(), guid);
}
after = DateTime.Now;
Console.Out.WriteLine(String.Format("Took {0}ms to do 10000
stores", ((TimeSpan)(after - beforeAsync)).TotalMilliseconds));
Prints the following timings:
Took 1734.3861ms to do 10000 stores
Took 62.5004ms to do 10000 stores
(Interestingly the *actual* time to do the 10000 stores asynchronously, came
out at about 1200ms, because many stores occurred in parallel fwiw)
Thanks
- Ciaran
--
- Ciaran