Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
ed25a33e
Commit
ed25a33e
authored
9 years ago
by
vjpai
Browse files
Options
Downloads
Patches
Plain Diff
Improved formatting
parent
5286eee5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/ruby/qps/client.rb
+13
-6
13 additions, 6 deletions
src/ruby/qps/client.rb
src/ruby/qps/server.rb
+2
-2
2 additions, 2 deletions
src/ruby/qps/server.rb
src/ruby/qps/worker.rb
+5
-3
5 additions, 3 deletions
src/ruby/qps/worker.rb
with
20 additions
and
11 deletions
src/ruby/qps/client.rb
+
13
−
6
View file @
ed25a33e
...
@@ -80,17 +80,24 @@ class BenchmarkClient
...
@@ -80,17 +80,24 @@ class BenchmarkClient
(
0
..
config
.
client_channels
-
1
).
each
do
|
i
|
(
0
..
config
.
client_channels
-
1
).
each
do
|
i
|
Thread
.
new
{
Thread
.
new
{
stub
=
''
stub
=
''
req
=
Grpc
::
Testing
::
SimpleRequest
.
new
(
response_type:
Grpc
::
Testing
::
PayloadType
::
COMPRESSABLE
,
gtsr
=
Grpc
::
Testing
::
SimpleRequest
response_size:
config
.
payload_config
.
simple_params
.
resp_size
,
gtpt
=
Grpc
::
Testing
::
PayloadType
payload:
Grpc
::
Testing
::
Payload
.
new
(
type:
Grpc
::
Testing
::
PayloadType
::
COMPRESSABLE
,
gtp
=
Grpc
::
Testing
::
Payload
body:
nulls
(
config
.
payload_config
.
simple_params
.
req_size
)))
simple_params
=
config
.
payload_config
.
simple_params
req
=
gtsr
.
new
(
response_type:
gtpt
::
COMPRESSABLE
,
response_size:
simple_params
.
resp_size
,
payload:
gtp
.
new
(
type:
gtpt
::
COMPRESSABLE
,
body:
nulls
(
simple_params
.
req_size
)))
case
config
.
load_params
.
load
.
to_s
case
config
.
load_params
.
load
.
to_s
when
'closed_loop'
when
'closed_loop'
waiter
=
nil
waiter
=
nil
when
'poisson'
when
'poisson'
waiter
=
Poisson
.
new
(
config
.
load_params
.
poisson
.
offered_load
/
config
.
client_channels
)
waiter
=
Poisson
.
new
(
config
.
load_params
.
poisson
.
offered_load
/
config
.
client_channels
)
end
end
stub
=
Grpc
::
Testing
::
BenchmarkService
::
Stub
.
new
(
config
.
server_targets
[
i
%
config
.
server_targets
.
length
],
cred
)
gtbss
=
Grpc
::
Testing
::
BenchmarkService
::
Stub
st
=
config
.
server_targets
stub
=
gtbss
.
new
(
st
[
i
%
st
.
length
],
cred
)
case
config
.
rpc_type
case
config
.
rpc_type
when
:UNARY
when
:UNARY
unary_ping_ponger
(
req
,
stub
,
config
,
waiter
)
unary_ping_ponger
(
req
,
stub
,
config
,
waiter
)
...
...
This diff is collapsed.
Click to expand it.
src/ruby/qps/server.rb
+
2
−
2
View file @
ed25a33e
...
@@ -79,7 +79,8 @@ class BenchmarkServer
...
@@ -79,7 +79,8 @@ class BenchmarkServer
}
}
end
end
def
mark
(
reset
)
def
mark
(
reset
)
s
=
Grpc
::
Testing
::
ServerStats
.
new
(
time_elapsed:
(
Time
.
now
-
@start_time
).
to_f
)
s
=
Grpc
::
Testing
::
ServerStats
.
new
(
time_elapsed:
(
Time
.
now
-
@start_time
).
to_f
)
@start_time
=
Time
.
now
if
reset
@start_time
=
Time
.
now
if
reset
s
s
end
end
...
@@ -87,4 +88,3 @@ class BenchmarkServer
...
@@ -87,4 +88,3 @@ class BenchmarkServer
@port
@port
end
end
end
end
This diff is collapsed.
Click to expand it.
src/ruby/qps/worker.rb
+
5
−
3
View file @
ed25a33e
...
@@ -54,13 +54,14 @@ class WorkerServiceImpl < Grpc::Testing::WorkerService::Service
...
@@ -54,13 +54,14 @@ class WorkerServiceImpl < Grpc::Testing::WorkerService::Service
q
=
EnumeratorQueue
.
new
(
self
)
q
=
EnumeratorQueue
.
new
(
self
)
Thread
.
new
{
Thread
.
new
{
bms
=
''
bms
=
''
gtss
=
Grpc
::
Testing
::
ServerStatus
reqs
.
each
do
|
req
|
reqs
.
each
do
|
req
|
case
req
.
argtype
.
to_s
case
req
.
argtype
.
to_s
when
'setup'
when
'setup'
bms
=
BenchmarkServer
.
new
(
req
.
setup
,
@server_port
)
bms
=
BenchmarkServer
.
new
(
req
.
setup
,
@server_port
)
q
.
push
(
Grpc
::
Testing
::
ServerStatu
s
.
new
(
stats:
bms
.
mark
(
false
),
port:
bms
.
get_port
))
q
.
push
(
gts
s
.
new
(
stats:
bms
.
mark
(
false
),
port:
bms
.
get_port
))
when
'mark'
when
'mark'
q
.
push
(
Grpc
::
Testing
::
ServerStatu
s
.
new
(
stats:
bms
.
mark
(
req
.
mark
.
reset
),
cores:
cpu_cores
))
q
.
push
(
gts
s
.
new
(
stats:
bms
.
mark
(
req
.
mark
.
reset
),
cores:
cpu_cores
))
end
end
end
end
q
.
push
(
self
)
q
.
push
(
self
)
...
@@ -78,7 +79,8 @@ class WorkerServiceImpl < Grpc::Testing::WorkerService::Service
...
@@ -78,7 +79,8 @@ class WorkerServiceImpl < Grpc::Testing::WorkerService::Service
client
=
BenchmarkClient
.
new
(
req
.
setup
)
client
=
BenchmarkClient
.
new
(
req
.
setup
)
q
.
push
(
Grpc
::
Testing
::
ClientStatus
.
new
(
stats:
client
.
mark
(
false
)))
q
.
push
(
Grpc
::
Testing
::
ClientStatus
.
new
(
stats:
client
.
mark
(
false
)))
when
'mark'
when
'mark'
q
.
push
(
Grpc
::
Testing
::
ClientStatus
.
new
(
stats:
client
.
mark
(
req
.
mark
.
reset
)))
q
.
push
(
Grpc
::
Testing
::
ClientStatus
.
new
(
stats:
client
.
mark
(
req
.
mark
.
reset
)))
end
end
end
end
q
.
push
(
self
)
q
.
push
(
self
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment