ideawu / ssdb

SSDB - A fast NoSQL database, an alternative to Redis
http://ssdb.io/
BSD 3-Clause "New" or "Revised" License
8.18k stars 1.4k forks source link

Does SSDB need separate connections per parallel request? #538

Open 0xgeert opened 9 years ago

0xgeert commented 9 years ago

In Redis, custom is to use 1 connection for multiple parallel requests. This works fine (unless you get interleaved watch/multi-exec calls).

Am I correct to assume that this IS NOT okay in SSDB? Primarily since SSDB is disk-bound as opposed to Redis.

ideawu commented 9 years ago

Hi, batch-exec could not be nested(you could not call batch between a batch-exec pair).

0xgeert commented 9 years ago

Sorry, I didn't explain myself well.

I am not doing batch-exec calls, I just have a lot of requests doing parallel gets/sets,etc. Normally in Redis you only need 1 connection for this since using multiple connections doesn't increase performance (since Redis itself is singlethreaded as well) .

However, since SSDB is disk-bound, I imagine performance can be increased when using multiple connections for parallel requests, no?

ideawu commented 9 years ago

Hi, using multi connections could normally increase throughput, because it get rid of network round trip time. Imagine you send two requests through two connections, the two requests reach the server at the same time, and the response return at the same time. If you use single connection, you wait for the first request to get to the server, and wait before the response returns, then you can send the second request.