Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protobuf serialization in Ruby very expensive #12

Open
clifton opened this issue Sep 6, 2013 · 4 comments · Fixed by #39
Open

Protobuf serialization in Ruby very expensive #12

clifton opened this issue Sep 6, 2013 · 4 comments · Fixed by #39

Comments

@clifton
Copy link

clifton commented Sep 6, 2013

Hey Kyle,

@justinsteffy and I have been hitting performance snags doing 50-100 serializations during the request response cycle. We've identified that most of the time is spent in the beefcake library doing protobuf serialization. Have you had any issues with this?

r = Riemann::Client.new
# => #<Riemann::Client:0x00000001fc3040 @host="127.0.0.1", @port=5555, @timeout=5, @udp=#<Riemann::Client::UDP:0x00000001fc2fc8 @host="127.0.0.1", @port=5555, @max_size=16384, @locket=#<Mutex:0x00000001fcafc0>>, @tcp=#<Riemann::Client::TCP:0x00000001fcaf98 @host="127.0.0.1", @port=5555, @timeout=5, @locket=#<Mutex:0x00000001fcaf70>>>
r << { service: 'testing', metric: 1.0, tags: ['test', 'the', 'client'] }
# => nil
require 'benchmark'
# => true
Benchmark.measure do
  1000.times do
    r << { service: 'testing', metric: 1.0, tags: ['test', 'the', 'client'] }
  end
end
=>   0.120000   0.060000   0.180000 (  0.185700)
@ghost
Copy link

ghost commented Sep 6, 2013

Wouldn't be surprised, but I'm pretty much all JVM these days so I haven't hit performance issues personally. If you have alternative suggestions for a protobuf library (or improvements to Beefcake) I'd be open to a PR.

@jamtur01
Copy link
Member

@smortex I never looked very far at this but beefcake is fairly old at this point. There's the Google protobuf ruby client itself (https://rubygems.org/gems/google-protobuf) from memory and some other alternative gems like https://github.com/ruby-protobuf/protobuf too.

@jamtur01
Copy link
Member

Looks like https://github.com/ruby-protobuf/protobuf would pretty much a near drop-in replacement assuming we could benchmark it against beefcake.

smortex added a commit that referenced this issue Jun 25, 2022
Performance of the Protobuf library is slightly better: comparing the
test suite "benchmark" (should query quickly, should be threadsafe)
before and after the change, we have the following figures:

Queries / second:

| Protocol | Before  |  After | Improvement |
|:---------|--------:|-------:|------------:|
| TLS      |  544.38 | 2957.54|        543% |
| TCP      | 1076.96 | 3688.43|        342% |
| UDP      | 1282.52 | 3644.92|        284% |

Inserts / second:

| Protocol | Before  |  After  | Improvement |
|:---------|--------:|--------:|------------:|
| TLS      | 1452.51 | 5155.62 |        354% |
| TCP      | 2860.25 | 6709.74 |        234% |
| UDP      | 4834.24 | 8158.35 |        168% |
jamtur01 added a commit that referenced this issue Jun 25, 2022
(#12) Switch from Beefcake to Protobuf
smortex added a commit that referenced this issue Jun 25, 2022
This reverts commit 5ab5de4.

See discussion in #41
jamtur01 added a commit that referenced this issue Jun 25, 2022
…eabef556baef79

Revert "(#12) Switch from Beefcake to Protobuf"
@smortex
Copy link
Collaborator

smortex commented Jun 26, 2022

Reopen since we reverted the change and we must investigate this

@smortex smortex reopened this Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants