Object size / performance
Is there any reason that makes a string with less then 1422 chars take 0/1ms to be stored, and a string with 1423 chars take 38/40ms to be stored?
string with 1416 taked 0ms
string with 1417 taked 0ms
string with 1418 taked 0ms
string with 1419 taked 0ms
string with 1420 taked 0ms
string with 1421 taked 0ms
string with 1422 taked 0ms
string with 1423 taked 38ms
string with 1424 taked 40ms
string with 1425 taked 40ms
string with 1426 taked 40ms
string with 1427 taked 41ms
string with 1428 taked 41ms
string with 1428 taked 41ms
string with 1427 taked 38ms
string with 1426 taked 39ms
string with 1425 taked 41ms
string with 1424 taked 41ms
string with 1423 taked 37ms
string with 1422 taked 2ms
string with 1421 taked 1ms
string with 1420 taked 1ms
string with 1419 taked 1ms
string with 1418 taked 1ms
I have repeated the test a thousand times, it always start to take 40ms after exact 1422 chars.
Is there any way i can change this behavior?, i want to store documents around 2000 chars.
Using couchbase server 2.0 build 1956 (2 nodes, 1GB Ram each) and .Net Client 1.2 beta
Thanks.
[TestMethod] public void StoreSizePerfTest() { var client = new CouchbaseClient(); var testObject = "a"; var result = client.Store(Enyim.Caching.Memcached.StoreMode.Set, "testObject", testObject); Assert.IsTrue(result); var sw = new Stopwatch(); for (int i = 0; i < 1500; i++) { testObject += "a"; sw.Restart(); var s = client.Store(Enyim.Caching.Memcached.StoreMode.Set, "testObject", testObject); sw.Stop(); Assert.IsTrue(s); Debug.WriteLine(String.Format("string with {0} chars taked {1}ms",testObject.Length, sw.ElapsedMilliseconds)); } }
Hi Norsalla,
I modified the code slightly to run in a Console app and I saw very different results. I ran the app against a 3 node cluster and didn't see the same behavior. Operations were consistently less than 10ms to run, though there were spikes as I bumped up the loop to 150000 inserts. The cluster I ran this against is a bit underpowered, so I'm not surprised to have some delays.
Could you describe the environment in which you're running the test?
-- jz
public static void Main(string[] args)
{
var config = new CouchbaseClientConfiguration();
config.Urls.Add(new Uri("http://10.3.2.223:8091/pools/"));
config.Bucket = "default";
var client = new CouchbaseClient(config);
var testObject = "a";
var result = client.ExecuteStore(Enyim.Caching.Memcached.StoreMode.Set, "testObject", testObject);
var sw = new Stopwatch();
for (int i = 0; i < 1500; i++)
{
testObject += "a";
sw.Restart();
var s = client.Store(Enyim.Caching.Memcached.StoreMode.Set, "testObject", testObject);
Debug.Assert(s);
sw.Stop();
if (sw.ElapsedMilliseconds > 5)
{
Console.WriteLine("{0} chars: time {1}ms", testObject.Length, sw.ElapsedMilliseconds);
}
}
}741 chars: time 14ms
3675 chars: time 16ms
5019 chars: time 14ms
5427 chars: time 12ms
6313 chars: time 11ms
6444 chars: time 28ms
6573 chars: time 17ms
6777 chars: time 47ms
6916 chars: time 12ms
9396 chars: time 46ms
9882 chars: time 16ms
10731 chars: time 31ms
14024 chars: time 19ms
14787 chars: time 12ms
14871 chars: time 12ms
14965 chars: time 11ms
14989 chars: time 28ms
Press any key to continue . . .
1125 chars: time 32ms
5718 chars: time 21ms
8330 chars: time 13ms
12230 chars: time 18ms
14635 chars: time 12ms
Press any key to continue . . .
1885 chars: time 26ms
1944 chars: time 12ms
2437 chars: time 13ms
2775 chars: time 13ms
2780 chars: time 13ms
2781 chars: time 11ms
3254 chars: time 11ms
3682 chars: time 16ms
5401 chars: time 12ms
6126 chars: time 14ms
7205 chars: time 16ms
7539 chars: time 11ms
9459 chars: time 14ms
9669 chars: time 64ms
10093 chars: time 17ms
12561 chars: time 16ms
12581 chars: time 16ms
12717 chars: time 58ms
13365 chars: time 21ms
Press any key to continue . . .
I just spent a few hours troubleshooting and found out that it was caused by my VMware network configuration, the 2 couchbase nodes where accidentally located in a different network than my testing machine, probably some kind of MTU / Routing thing was causing the times to go up after some 1500 bytes.
Now they are all in the same vmware network and things are pretty fast, i cant get more than 1 ms in the same test no matter what size :)
Thanks very much for all the attention.
My environment:
Host Machine
i7 3770, 8GB RAM, Windows 7 x64
Development Machine (VMWare VM)
2 Cores, 2GB RAM, Windows 7 x64
Node 1 (VMWare VM)
2 Cores, 1GB RAM, Ubuntu Server 12.04.1 LTS / CouchBase 2.0 build 1956
Node 2 (VMWare VM)
2 Cores, 1GB RAM, Ubuntu Server 12.04.1 LTS / CouchBase 2.0 build 1956
Strange, this might be a bug in the client driver. Can you post your example code?