MB-5408: use pool of ns_memcached workers to handle requests

This change adds pool of workers per ns_memcached process. Each worker
establishes it's own memcached connection. And most memcached calls
are passed to this workers. And there's 100% fair queuing of this
calls. I.e. calls are centrally queued and dispatched to first
available worker.

There are 3 separate queues for 3 different classes of requests.

Very heavy requests are those that potentially may take minutes to run
and perform work proportional to bucket quota. Examples are
delete-vbucket & flush. Both this requests do lots of free() calls and
amount of memory freeing is clearly larger for larger buckets. I was
also told that delete-vbucket may be delayed by running eviction task.

Heavy requests are any requests that may potentially take few seconds
to run. Data operations (especially involving background fetch) are in
this class. 1.8.x doesn't need any data ops, but I've put state
mutation ops (set-vbucket-state) into this class just in case. This
will be more heavily used by 2.0 HTTP CRUD.

Fast requests are requests that should not take more then few
milliseconds to perform. That's all kinds of stats requests.

We always reserve at least one worker for fast requests. So that no
amount of heavy requests can slow down fast but important requests.

For very heavy requests current policy is to never allow more than 1
in flight. That should prevent ep-engine overload and prevent worker
processes from being occupied and thus not available for lighter
requests.

Change-Id: I463792726bb29a3aaaf7d5ababa832dff62ad154
Reviewed-on: http://review.couchbase.org/16570
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5307: support simple way to adjust some timeouts at runtime

Particularly timeouts affecting our communication with memcached.

This also makes few timeouts larger. Particularly memcached protocol
level timeouts (timeouts speaking to usually local memcached) are
increased.

As well as ns_memcached "outer" level (i.e. including potential queing
delay) timeouts of heavy operations.

Timeouts can be adjusted by settings node's config. Efficently reading
those timeout values is achieved by maintaining public named ets table
with all key-value pairs.

Example key is {node, node(), {timeout, ebucketmigrtor_connect}}.

Change-Id: I4c878213b8cc2710d03ecd56ff4f02080c2684c3
Reviewed-on: http://review.couchbase.org/16571
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5203 Include diag in collect_info

Also, get rid of cbupgrade dependency.

Change-Id: I77046d30aaadbf8e7cbc8f21feb22cd0bb405490
Reviewed-on: http://review.couchbase.org/16614
Tested-by: Bin Cui <bin.cui@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5402: avoid system_stats_collector crashing other services

System stats gathering is a cool thing. But MB-5402 points out that
sometimes we want to count some stats quite before
system_stats_collector configured ets table for stats. We're just
ignoring any exceptions from trying to update those stats now.

Change-Id: Ifd6b0a0e985e8213a0cfc12090fe6beb7df24607
Reviewed-on: http://review.couchbase.org/16632
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5307: allow just grabbing current archive of master events

It's useful to be able to just get current history without infinitely
streaming. That's particularly useful for tools that want to analyze
previous rebalance, because otherwise they need some heuristic to stop
streaming.

Change-Id: Ia2621d0a0a4a6f9d46e9d43361e392f5fb6aab07
Reviewed-on: http://review.couchbase.org/16633
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-5307: unbreak cli ebucketmigrator

Change-Id: Ie9e09ac62085cc9ffee4cb807a90d34fe63cdf1e
Reviewed-on: http://review.couchbase.org/16767
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-5307:ebucketmigrator:dont ask password when not given username

Change-Id: I4156d2be4314f553e74e80e56b185ccc39a61f1b
Reviewed-on: http://review.couchbase.org/16768
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Merge commit '27fbb5333af2...' into branch-18

* commit '27fbb5333af28875037c17f308f2e6d39913d6a7':
  MB-5307:ebucketmigrator:dont ask password when not given username
  MB-5307: unbreak cli ebucketmigrator
  MB-5307: allow just grabbing current archive of master events
  MB-5402: avoid system_stats_collector crashing other services
  MB-5203 Include diag in collect_info
  MB-5307: support simple way to adjust some timeouts at runtime
  MB-5408: use pool of ns_memcached workers to handle requests

This merge was trivial

Change-Id: Ib981183ecf80ebb7cbb21dd2015c71ca49597391