{"action":"created","issue":{"url":"https://api.github.com/repos/grpc/grpc-java/issues/368","labels_url":"https://api.github.com/repos/grpc/grpc-java/issues/368/labels{/name}","comments_url":"https://api.github.com/repos/grpc/grpc-java/issues/368/comments","events_url":"https://api.github.com/repos/grpc/grpc-java/issues/368/events","html_url":"https://github.com/grpc/grpc-java/issues/368","id":72361886,"number":368,"title":"Don't use SerializingExecutor when running with a direct executor.","user":{"login":"buchgr","id":1388179,"avatar_url":"https://avatars.githubusercontent.com/u/1388179?v=3","gravatar_id":"","url":"https://api.github.com/users/buchgr","html_url":"https://github.com/buchgr","followers_url":"https://api.github.com/users/buchgr/followers","following_url":"https://api.github.com/users/buchgr/following{/other_user}","gists_url":"https://api.github.com/users/buchgr/gists{/gist_id}","starred_url":"https://api.github.com/users/buchgr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buchgr/subscriptions","organizations_url":"https://api.github.com/users/buchgr/orgs","repos_url":"https://api.github.com/users/buchgr/repos","events_url":"https://api.github.com/users/buchgr/events{/privacy}","received_events_url":"https://api.github.com/users/buchgr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-05-01T05:42:24Z","updated_at":"2015-05-04T16:36:35Z","closed_at":null,"body":"I wanted to know what the impact of the `SerializingExecutor` is when running with a direct executor.\r\n\r\nSo I did 3 benchmarks, choosing the best out of 3 runs.\r\n\r\n##### Direct Executor + Serializing (current master)\r\n```\r\nbuchgr@buchgr0:~/Code/grpc-java/benchmarks/build/install/grpc-benchmarks/bin$ ./qps_client --port=33333 --host=localhost --channels=8 --outstanding_rpcs_per_channel=10 --warmup_duration=10s --duration=30s --server_payload=1 --client_payload=1 --directexecutor\r\nChannels:                       8\r\nOutstanding RPCs per Channel:   10\r\nServer Payload Size:            1\r\nClient Payload Size:            1\r\n50%ile Latency (in micros):     669\r\n90%ile Latency (in micros):     1817\r\n95%ile Latency (in micros):     3231\r\n99%ile Latency (in micros):     5727\r\n99.9%ile Latency (in micros):   9255\r\nQPS:                            78642\r\n```\r\n\r\n##### Direct Executor + Serializing Executor without synchronized blocks.\r\n```\r\nbuchgr@buchgr0:~/Code/grpc-java/benchmarks/build/install/grpc-benchmarks/bin$ ./qps_client --port=33333 --host=localhost --channels=8 --outstanding_rpcs_per_channel=10 --warmup_duration=10s --duration=30s --server_payload=1 --client_payload=1 --directexecutor\r\nChannels:                       8\r\nOutstanding RPCs per Channel:   10\r\nServer Payload Size:            1\r\nClient Payload Size:            1\r\n50%ile Latency (in micros):     655\r\n90%ile Latency (in micros):     1647\r\n95%ile Latency (in micros):     3083\r\n99%ile Latency (in micros):     5679\r\n99.9%ile Latency (in micros):   9607\r\nQPS:                            81500\r\n```\r\n\r\n##### Direct Executor only, no Serializing Executor\r\n```\r\nbuchgr@buchgr0:~/Code/grpc-java/benchmarks/build/install/grpc-benchmarks/bin$ ./qps_client --port=33333 --host=localhost --channels=8 --outstanding_rpcs_per_channel=10 --warmup_duration=10s --duration=30s --server_payload=1 --client_payload=1 --directexecutor\r\nChannels:                       8\r\nOutstanding RPCs per Channel:   10\r\nServer Payload Size:            1\r\nClient Payload Size:            1\r\n50%ile Latency (in micros):     619\r\n90%ile Latency (in micros):     1096\r\n95%ile Latency (in micros):     1132\r\n99%ile Latency (in micros):     3999\r\n99.9%ile Latency (in micros):   11407\r\nQPS:                            99904\r\n```\r\n\r\nSo it seems to me that the potential improvement is significant enough to make some changes and not use a `SerializingExecutor` when using direct i.e. by adding an option to the Server / Channel Builders. \r\nWDYT @nmittler @louiscryan @ejona86 ?"},"comment":{"url":"https://api.github.com/repos/grpc/grpc-java/issues/comments/98774346","html_url":"https://github.com/grpc/grpc-java/issues/368#issuecomment-98774346","issue_url":"https://api.github.com/repos/grpc/grpc-java/issues/368","id":98774346,"user":{"login":"ejona86","id":2811396,"avatar_url":"https://avatars.githubusercontent.com/u/2811396?v=3","gravatar_id":"","url":"https://api.github.com/users/ejona86","html_url":"https://github.com/ejona86","followers_url":"https://api.github.com/users/ejona86/followers","following_url":"https://api.github.com/users/ejona86/following{/other_user}","gists_url":"https://api.github.com/users/ejona86/gists{/gist_id}","starred_url":"https://api.github.com/users/ejona86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejona86/subscriptions","organizations_url":"https://api.github.com/users/ejona86/orgs","repos_url":"https://api.github.com/users/ejona86/repos","events_url":"https://api.github.com/users/ejona86/events{/privacy}","received_events_url":"https://api.github.com/users/ejona86/received_events","type":"User","site_admin":false},"created_at":"2015-05-04T16:36:35Z","updated_at":"2015-05-04T16:36:35Z","body":"I agree with @buchgr's proposal on having a `directExecutor()` on the Builders.\r\n\r\nIf we wanted our options to be orthogonal, we could have an option `disableSerializedCallbacks()` or some such. We could still have `directExecutor()` which would be the equivalent of calling `executor(directExecutor)` and `disableSerializedCallbacks()`. I don't have many other use cases of `disableSerializedCallbacks()`, though, so I question if it is useful. I've considered fanning out streaming requests to multiple threads. Also an \"advanced\" direct executor that sets a thread-local or some such."}}