Search:

Search all manuals
Search this manual
Manual
Moxi Server 1.8
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
3 Standalone Moxi Component
Chapter Sections
Chapters

3.7. Increasing Concurrency

3.7. Increase Worker Threads
3.7. Increase Number of Concurrent Client Requests
3.7. Implications
3.7. Downstream conn queues

There are a couple ways to increase concurrency in moxi:

Increase Worker Threads

By default, moxi uses 4 worker threads. This can be changed via the -t THREAD_NUM flag. For example:

shell> moxi -t 6 -Z port_listen=11311 http://membase1:8091/pools/default/bucketsStreaming/shoppingCarts

Increase Number of Concurrent Client Requests

moxi limits the number of inflight or concurrent client requests that it will send to the Couchbase cluster. This is controlled via the -Z concurrency configuration value, whose default value is 1024. For older users of moxi, the "concurrency" configuration parameter is also known as the "downstream_max" configuration parameter. For example, to set concurrency to 8:

shell> moxi -Z port_listen=11311,concurrency=8 http://membase1:8091/pools/default/bucketsStreaming/shoppingCarts

The formula of total number concurrent requests that moxi will process is:

NUM_THREADS x NUM_BUCKETS x concurrency

With the last command-line, then, the NUM_THREADS defaults to 4. There's only one bucket involved (the shoppingCarts bucket), so NUM_BUCKETS is 1. And, concurrency has been overridden to be 8. So, there will be moxi allow only 32 concurrent client requests to be processed. All other client requests will go onto a wait queue until active requests are finished.

Implications

Increasing concurrency and the number of worker threads isn't necessarily a free lunch. More threads, for example, means using resources that other processes (such as your web app servers) might need. Higher concurrency settings from moxi (when multiplied by the number moxi's you've deployed) means more connections will be created to downstream servers, which can eventually cause other performance issues or hit connection (file descriptor) limits.

Downstream conn queues

More information on the downstream conn queues is available: Chapter 2, Following A Request Through Moxi.