Reduce CPU usage in netty epoll wait

Description

Some amount of CPU (on my environment it is about 4%) is consumed in wait cycle caused by com.datastax.driver.core.Connection.Flusher#run

There is a similar issue for Cassandra server: https://issues.apache.org/jira/browse/CASSANDRA-13651

Update to the latest netty native transport version which supports microsecond resolution for the schedule latency does not eliminate the issue completely because kernel.sys_timerfd calls are quite expensive (see also: https://github.com/apache/cassandra/pull/151/commits/60da9184d8dcd1b06fc13f6b093ab2ec35c5eb80)

We can propagate the change suggested in CASSANDRA-13651 to Cassandra driver side as well.

Resolution:

The flush schedule interval (com.datastax.driver.FLUSHER_SCHEDULE_PERIOD_NS, defaults to 10000) and the amount of times to run without work before stopping scheduling (FLUSHER_RUN_WITHOUT_WORK_TIMES, defaults to 5) are now configurable via system property. The defaults match the existing behavior, so this allows experimentation to find ideal values for use. We will follow the discussion CASSANDRA-13651.

Environment

netty native epoll transport is used

Linux 2.6.32-642.el6.x86_64 #1 SMP Wed Apr 13 00:51:26 EDT 2016
x86_64 x86_64 x86_64 GNU/Linux

Pull Requests

None
Fixed

Assignee

Unassigned

Reporter

Dmitry Konstantinov

Labels

PM Priority

None

Affects versions

Fix versions

Doc Impact

None

Size

None

External issue ID

None

External issue ID

None

Components

Priority

Major
Configure