Skip to content

Commit

Permalink
Adding datadog gem benchmarks for cross comparison
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
  • Loading branch information
pedro-stanaka committed Dec 18, 2024
1 parent d1503d1 commit c2aa9cd
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions benchmark/local-udp-throughput
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@ require "datadog/statsd"
require "forwardable"
require "vernier"

module Datadog
class Statsd
class Telemetry
def flush
["bytes", "packets"].each do |kind|
["sent", "dropped", "dropped_queue", "dropped_writer"].each do |measure|
var = "#{kind}_#{measure}"
puts "#{var}: #{instance_variable_get("@#{var}".to_sym)}"
end
end
puts "-" * 10

[]
end
end
end
end

class DatadogShim
extend Forwardable

Expand Down Expand Up @@ -222,3 +240,40 @@ benchmark_implementation(
if ENABLE_PROFILING
Vernier.stop_profile
end

if ENABLE_PROFILING
Vernier.start_profile(out: "tmp/benchmark_profile_datadog.json")
end
benchmark_implementation(
"Datadog client with UDP and delayed serialization",
{
buffer_max_payload_size: 4096,
delay_serialization: true,
telemetry_flush_interval: 1,
# The datadog implemtation will drop metrics if the queue is full
# to imitate the behavior of the implementation of this gem, we set
# the queue size to infinity to avoid dropping metrics.
sender_queue_size: Float::INFINITY,
},
true,
)
if ENABLE_PROFILING
Vernier.stop_profile
end

if ENABLE_PROFILING
Vernier.start_profile(out: "tmp/benchmark_profile_datadog.json")
end
benchmark_implementation(
"UDP - Datadog gem - using: delay_serialization, multi-threaded, allow dropping samples",
{
buffer_max_payload_size: 4096,
delay_serialization: true,
telemetry_flush_interval: 1,
sender_queue_size: 250_000,
},
true,
)
if ENABLE_PROFILING
Vernier.stop_profile
end

0 comments on commit c2aa9cd

Please sign in to comment.