Skip to content

Commit

Permalink
raw bench
Browse files Browse the repository at this point in the history
  • Loading branch information
danmayer committed Feb 3, 2025
1 parent f529213 commit 6ad3f5e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions bin/benchmark
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ payload = 'B' * bench_payload_size
TERMINATOR = "\r\n"
puts "yjit: #{RubyVM::YJIT.enabled?}"

client = Dalli::Client.new('localhost', serializer: StringSerializer, compress: false)
multi_client = Dalli::Client.new('localhost:11211,localhost:11222', serializer: StringSerializer, compress: false)
string_client = Dalli::Client.new('localhost', serializer: StringSerializer, compress: false)
client = Dalli::Client.new('localhost', serializer: StringSerializer, compress: false, raw: true)
multi_client = Dalli::Client.new('localhost:11211,localhost:11222', serializer: StringSerializer, compress: false, raw: true)

# The raw socket implementation is used to benchmark the performance of dalli & the overhead of the various abstractions
# in the library.
sock = TCPSocket.new('127.0.0.1', '11211', connect_timeout: 1)
Expand All @@ -61,7 +61,6 @@ sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, 1024 * 1024 * 8)

# ensure the clients are all connected and working
client.set('key', payload)
string_client.set('string_key', payload)
sock.write("set sock_key 0 3600 #{payload.bytesize}\r\n")
sock.write(payload)
sock.write(TERMINATOR)
Expand Down

0 comments on commit 6ad3f5e

Please sign in to comment.