RPC cpu pool (#6023)

* RPC cpu pool.

* introduce optional thread pool when processing RPC requests.

* Bump jsonrpc.

* Removing boxes.

* Fix CLI tests.
This commit is contained in:
Tomasz Drwięga
2017-07-11 12:22:19 +02:00
committed by Gav Wood
parent dc51dde112
commit 7fb46bff06
10 changed files with 103 additions and 43 deletions

View File

@@ -180,8 +180,10 @@ usage! {
or |c: &Config| otry!(c.rpc).apis.as_ref().map(|vec| vec.join(",")),
flag_jsonrpc_hosts: String = "none",
or |c: &Config| otry!(c.rpc).hosts.as_ref().map(|vec| vec.join(",")),
flag_jsonrpc_threads: Option<usize> = None,
or |c: &Config| otry!(c.rpc).threads.map(Some),
flag_jsonrpc_server_threads: Option<usize> = None,
or |c: &Config| otry!(c.rpc).server_threads.map(Some),
flag_jsonrpc_threads: usize = 0usize,
or |c: &Config| otry!(c.rpc).processing_threads,
// WS
flag_no_ws: bool = false,
@@ -468,7 +470,8 @@ struct Rpc {
cors: Option<String>,
apis: Option<Vec<String>>,
hosts: Option<Vec<String>>,
threads: Option<usize>,
server_threads: Option<usize>,
processing_threads: Option<usize>,
}
#[derive(Default, Debug, PartialEq, Deserialize)]
@@ -749,7 +752,8 @@ mod tests {
flag_jsonrpc_cors: Some("null".into()),
flag_jsonrpc_apis: "web3,eth,net,parity,traces,rpc,secretstore".into(),
flag_jsonrpc_hosts: "none".into(),
flag_jsonrpc_threads: None,
flag_jsonrpc_server_threads: None,
flag_jsonrpc_threads: 0,
// WS
flag_no_ws: false,
@@ -977,7 +981,8 @@ mod tests {
cors: None,
apis: None,
hosts: None,
threads: None,
server_threads: None,
processing_threads: None,
}),
ipc: Some(Ipc {
disable: None,

View File

@@ -176,9 +176,12 @@ API and Console Options:
is additional security against some attack
vectors. Special options: "all", "none",
(default: {flag_jsonrpc_hosts}).
--jsonrpc-threads THREADS Enables experimental faster implementation of JSON-RPC server.
--jsonrpc-server-threads NUM Enables experimental faster implementation of JSON-RPC server.
Requires Dapps server to be disabled
using --no-dapps. (default: {flag_jsonrpc_threads:?})
using --no-dapps. (default: {flag_jsonrpc_server_threads:?})
--jsonrpc-threads THREADS Turn on additional processing threads in all RPC servers.
Setting this to non-zero value allows parallel cpu-heavy queries
execution. (default: {flag_jsonrpc_threads})
--no-ws Disable the WebSockets server. (default: {flag_no_ws})
--ws-port PORT Specify the port portion of the WebSockets server