amq-protocol 2.5.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog.md +5 -2
- data/lib/amq/protocol/version.rb +1 -1
- metadata +3 -55
- data/.github/ISSUE_TEMPLATE.md +0 -18
- data/.github/workflows/ci.yml +0 -31
- data/.gitignore +0 -18
- data/.gitmodules +0 -3
- data/.rspec +0 -1
- data/.travis.yml +0 -17
- data/AGENTS.md +0 -23
- data/CLAUDE.md +0 -1
- data/GEMINI.md +0 -1
- data/Gemfile +0 -27
- data/Rakefile +0 -55
- data/amq-protocol.gemspec +0 -27
- data/benchmarks/frame_encoding.rb +0 -75
- data/benchmarks/int_allocator.rb +0 -34
- data/benchmarks/method_encoding.rb +0 -198
- data/benchmarks/pack_unpack.rb +0 -158
- data/benchmarks/pure/body_framing_with_256k_payload.rb +0 -28
- data/benchmarks/pure/body_framing_with_2k_payload.rb +0 -28
- data/benchmarks/run_all.rb +0 -64
- data/benchmarks/table_encoding.rb +0 -110
- data/codegen/__init__.py +0 -0
- data/codegen/amqp_0.9.1_changes.json +0 -1
- data/codegen/codegen.py +0 -151
- data/codegen/codegen_helpers.py +0 -162
- data/codegen/protocol.rb.pytemplate +0 -320
- data/generate.rb +0 -24
- data/profiling/README.md +0 -9
- data/profiling/stackprof/body_framing_with_2k_payload.rb +0 -33
- data/spec/amq/bit_set_spec.rb +0 -249
- data/spec/amq/endianness_spec.rb +0 -23
- data/spec/amq/int_allocator_spec.rb +0 -136
- data/spec/amq/pack_spec.rb +0 -58
- data/spec/amq/protocol/basic_spec.rb +0 -325
- data/spec/amq/protocol/blank_body_encoding_spec.rb +0 -9
- data/spec/amq/protocol/channel_spec.rb +0 -127
- data/spec/amq/protocol/confirm_spec.rb +0 -41
- data/spec/amq/protocol/connection_spec.rb +0 -146
- data/spec/amq/protocol/constants_spec.rb +0 -10
- data/spec/amq/protocol/exceptions_spec.rb +0 -70
- data/spec/amq/protocol/exchange_spec.rb +0 -106
- data/spec/amq/protocol/float_32bit_spec.rb +0 -27
- data/spec/amq/protocol/frame_spec.rb +0 -156
- data/spec/amq/protocol/method_spec.rb +0 -43
- data/spec/amq/protocol/queue_spec.rb +0 -126
- data/spec/amq/protocol/table_spec.rb +0 -291
- data/spec/amq/protocol/tx_spec.rb +0 -55
- data/spec/amq/protocol/value_decoder_spec.rb +0 -183
- data/spec/amq/protocol/value_encoder_spec.rb +0 -161
- data/spec/amq/protocol_spec.rb +0 -812
- data/spec/amq/settings_spec.rb +0 -58
- data/spec/amq/uri_parsing_spec.rb +0 -287
- data/spec/spec_helper.rb +0 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7bd349803818e5eee9dbba49cdf59fad9666e8e7ed95229ed1bc7e7a4380fde5
|
|
4
|
+
data.tar.gz: b52bae3819d6fae2b2c6db5e1626ef6b98de74b0d24532b12f9a88ac75278ceb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a138a490585effe6886c7b16f4bb4c0a9d7f878358bca45ee437ae714ebcef4375b9f684651e593906db4d61dabd9468290ee3b75f1ca2810f8855f82e6942c
|
|
7
|
+
data.tar.gz: 7f64f831d2cdca5885ab08967c3700519acf90c327307e79bac757a58b56d3a02acc3bbd41731a456b52f9b92f0678a1d5c7d0c68eff94febb09bc0b45239ded
|
data/ChangeLog.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
## Changes between 2.5.0 and 2.
|
|
1
|
+
## Changes between 2.5.0 and 2.5.1 (Jan 1, 2026)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
### Windows Installation Fixes
|
|
4
|
+
|
|
5
|
+
`2.4.0` and `2.5.0` versions unintentionally included files that were
|
|
6
|
+
symlinks, which caused installation on Windows to fail.
|
|
4
7
|
|
|
5
8
|
|
|
6
9
|
## Changes between 2.4.0 and 2.5.0 (Dec 31, 2025)
|
data/lib/amq/protocol/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: amq-protocol
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.5.
|
|
4
|
+
version: 2.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jakub Stastny
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
- Mark Abramov
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2026-01-20 00:00:00.000000000 Z
|
|
14
14
|
dependencies: []
|
|
15
15
|
description: |2
|
|
16
16
|
amq-protocol is an AMQP 0.9.1 serialization library for Ruby. It is not a
|
|
@@ -22,35 +22,9 @@ extensions: []
|
|
|
22
22
|
extra_rdoc_files:
|
|
23
23
|
- README.md
|
|
24
24
|
files:
|
|
25
|
-
- ".github/ISSUE_TEMPLATE.md"
|
|
26
|
-
- ".github/workflows/ci.yml"
|
|
27
|
-
- ".gitignore"
|
|
28
|
-
- ".gitmodules"
|
|
29
|
-
- ".rspec"
|
|
30
|
-
- ".travis.yml"
|
|
31
|
-
- AGENTS.md
|
|
32
|
-
- CLAUDE.md
|
|
33
25
|
- ChangeLog.md
|
|
34
|
-
- GEMINI.md
|
|
35
|
-
- Gemfile
|
|
36
26
|
- LICENSE
|
|
37
27
|
- README.md
|
|
38
|
-
- Rakefile
|
|
39
|
-
- amq-protocol.gemspec
|
|
40
|
-
- benchmarks/frame_encoding.rb
|
|
41
|
-
- benchmarks/int_allocator.rb
|
|
42
|
-
- benchmarks/method_encoding.rb
|
|
43
|
-
- benchmarks/pack_unpack.rb
|
|
44
|
-
- benchmarks/pure/body_framing_with_256k_payload.rb
|
|
45
|
-
- benchmarks/pure/body_framing_with_2k_payload.rb
|
|
46
|
-
- benchmarks/run_all.rb
|
|
47
|
-
- benchmarks/table_encoding.rb
|
|
48
|
-
- codegen/__init__.py
|
|
49
|
-
- codegen/amqp_0.9.1_changes.json
|
|
50
|
-
- codegen/codegen.py
|
|
51
|
-
- codegen/codegen_helpers.py
|
|
52
|
-
- codegen/protocol.rb.pytemplate
|
|
53
|
-
- generate.rb
|
|
54
28
|
- lib/amq/bit_set.rb
|
|
55
29
|
- lib/amq/endianness.rb
|
|
56
30
|
- lib/amq/int_allocator.rb
|
|
@@ -68,32 +42,6 @@ files:
|
|
|
68
42
|
- lib/amq/protocol/version.rb
|
|
69
43
|
- lib/amq/settings.rb
|
|
70
44
|
- lib/amq/uri.rb
|
|
71
|
-
- profiling/README.md
|
|
72
|
-
- profiling/stackprof/body_framing_with_2k_payload.rb
|
|
73
|
-
- spec/amq/bit_set_spec.rb
|
|
74
|
-
- spec/amq/endianness_spec.rb
|
|
75
|
-
- spec/amq/int_allocator_spec.rb
|
|
76
|
-
- spec/amq/pack_spec.rb
|
|
77
|
-
- spec/amq/protocol/basic_spec.rb
|
|
78
|
-
- spec/amq/protocol/blank_body_encoding_spec.rb
|
|
79
|
-
- spec/amq/protocol/channel_spec.rb
|
|
80
|
-
- spec/amq/protocol/confirm_spec.rb
|
|
81
|
-
- spec/amq/protocol/connection_spec.rb
|
|
82
|
-
- spec/amq/protocol/constants_spec.rb
|
|
83
|
-
- spec/amq/protocol/exceptions_spec.rb
|
|
84
|
-
- spec/amq/protocol/exchange_spec.rb
|
|
85
|
-
- spec/amq/protocol/float_32bit_spec.rb
|
|
86
|
-
- spec/amq/protocol/frame_spec.rb
|
|
87
|
-
- spec/amq/protocol/method_spec.rb
|
|
88
|
-
- spec/amq/protocol/queue_spec.rb
|
|
89
|
-
- spec/amq/protocol/table_spec.rb
|
|
90
|
-
- spec/amq/protocol/tx_spec.rb
|
|
91
|
-
- spec/amq/protocol/value_decoder_spec.rb
|
|
92
|
-
- spec/amq/protocol/value_encoder_spec.rb
|
|
93
|
-
- spec/amq/protocol_spec.rb
|
|
94
|
-
- spec/amq/settings_spec.rb
|
|
95
|
-
- spec/amq/uri_parsing_spec.rb
|
|
96
|
-
- spec/spec_helper.rb
|
|
97
45
|
homepage: http://github.com/ruby-amqp/amq-protocol
|
|
98
46
|
licenses:
|
|
99
47
|
- MIT
|
|
@@ -112,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
112
60
|
- !ruby/object:Gem::Version
|
|
113
61
|
version: '0'
|
|
114
62
|
requirements: []
|
|
115
|
-
rubygems_version: 3.6.
|
|
63
|
+
rubygems_version: 3.6.2
|
|
116
64
|
specification_version: 4
|
|
117
65
|
summary: AMQP 0.9.1 encoding & decoding library.
|
|
118
66
|
test_files: []
|
data/.github/ISSUE_TEMPLATE.md
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
## Does This Really Belong to GitHub issues?
|
|
2
|
-
|
|
3
|
-
If you find a bug you understand well, poor default, incorrect or unclear piece of documentation,
|
|
4
|
-
or missing feature, please [file an
|
|
5
|
-
issue](http://github.com/ruby-amqp/bunny/issues) on GitHub.
|
|
6
|
-
|
|
7
|
-
Please use [Bunny's mailing list](http://groups.google.com/group/ruby-amqp) for questions,
|
|
8
|
-
investigations, and discussions. GitHub issues should be used for specific, well understood, actionable
|
|
9
|
-
maintainers and contributors can work on.
|
|
10
|
-
|
|
11
|
-
When filing an issue, please specify
|
|
12
|
-
|
|
13
|
-
* Which Bunny and RabbitMQ versions are used
|
|
14
|
-
* Recent RabbitMQ log file contents
|
|
15
|
-
* Full exception stack traces
|
|
16
|
-
* Steps to reproduce or a failing test case
|
|
17
|
-
|
|
18
|
-
This would greatly help the maintainers help you.
|
data/.github/workflows/ci.yml
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- "main"
|
|
7
|
-
pull_request:
|
|
8
|
-
branches:
|
|
9
|
-
- "main"
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
test:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
|
|
15
|
-
strategy:
|
|
16
|
-
matrix:
|
|
17
|
-
ruby-version:
|
|
18
|
-
- "3.4.2"
|
|
19
|
-
- "3.3.7"
|
|
20
|
-
- "3.2.7"
|
|
21
|
-
|
|
22
|
-
steps:
|
|
23
|
-
- uses: actions/checkout@v4
|
|
24
|
-
- name: Set up Ruby ${{ matrix.ruby-version }}
|
|
25
|
-
uses: ruby/setup-ruby@v1
|
|
26
|
-
with:
|
|
27
|
-
ruby-version: ${{ matrix.ruby-version }}
|
|
28
|
-
- name: Install dependencies
|
|
29
|
-
run: bundle install
|
|
30
|
-
- name: Run tests
|
|
31
|
-
run: bundle exec rspec -c
|
data/.gitignore
DELETED
data/.gitmodules
DELETED
data/.rspec
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
--require spec_helper
|
data/.travis.yml
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
dist: bionic
|
|
2
|
-
language: ruby
|
|
3
|
-
bundler_args: --without development
|
|
4
|
-
cache: bundler
|
|
5
|
-
script: "bundle exec rspec spec"
|
|
6
|
-
rvm:
|
|
7
|
-
- ruby-head
|
|
8
|
-
- "2.6.3"
|
|
9
|
-
- "2.5.5"
|
|
10
|
-
- "2.4.5"
|
|
11
|
-
- "2.3.8"
|
|
12
|
-
notifications:
|
|
13
|
-
recipients:
|
|
14
|
-
- michael@rabbitmq.com
|
|
15
|
-
matrix:
|
|
16
|
-
allow_failures:
|
|
17
|
-
- rvm: ruby-head
|
data/AGENTS.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# Instructions for AI Agents
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
This is a pure Ruby implementation of a AMQP 0-9-1 protocol parser
|
|
6
|
-
(more specifically% serialization, deserialization, framing) used by
|
|
7
|
-
[Bunny](https://github.com/ruby-amqp/bunny), a Ruby AMQP 0-9-1 client for RabbitMQ.
|
|
8
|
-
|
|
9
|
-
## Target Ruby Version
|
|
10
|
-
|
|
11
|
-
This library targets Ruby 3.0 and later versions.
|
|
12
|
-
|
|
13
|
-
## Comments
|
|
14
|
-
|
|
15
|
-
* Only add very important comments, both in tests and in the implementation
|
|
16
|
-
|
|
17
|
-
## Git Instructions
|
|
18
|
-
|
|
19
|
-
* Never add yourself to the list of commit co-authors
|
|
20
|
-
|
|
21
|
-
## Style Guide
|
|
22
|
-
|
|
23
|
-
* Never add full stops to Markdown list items
|
data/CLAUDE.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
AGENTS.md
|
data/GEMINI.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
AGENTS.md
|
data/Gemfile
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
source "https://rubygems.org"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
group :development do
|
|
7
|
-
# excludes Windows, Rubinius and JRuby
|
|
8
|
-
gem "ruby-prof", :platforms => [:mri_19, :mri_20, :mri_21]
|
|
9
|
-
|
|
10
|
-
gem "rake"
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
group :benchmark do
|
|
14
|
-
gem "benchmark-ips", "~> 2.12"
|
|
15
|
-
gem "benchmark-memory", "~> 0.2"
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
group :test do
|
|
19
|
-
gem "rspec", ">= 3.8.0"
|
|
20
|
-
gem "rspec-its"
|
|
21
|
-
gem "simplecov"
|
|
22
|
-
gem 'bigdecimal'
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
group :development, :test do
|
|
26
|
-
gem "byebug"
|
|
27
|
-
end
|
data/Rakefile
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
require "bundler"
|
|
2
|
-
Bundler.setup
|
|
3
|
-
|
|
4
|
-
require "rake"
|
|
5
|
-
require "rspec/core/rake_task"
|
|
6
|
-
|
|
7
|
-
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
|
8
|
-
require "amq/protocol/version"
|
|
9
|
-
|
|
10
|
-
task :gem => :build
|
|
11
|
-
task :build do
|
|
12
|
-
system "gem build amq-protocol.gemspec"
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
task :install => :build do
|
|
16
|
-
system "gem install amq-protocol-#{AMQ::Protocol::VERSION}.gem"
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def extension
|
|
20
|
-
RUBY_PLATFORM =~ /darwin/ ? "bundle" : "so"
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def compile!
|
|
24
|
-
puts "Compiling native extensions..."
|
|
25
|
-
Dir.chdir(Pathname(__FILE__).dirname + "ext/") do
|
|
26
|
-
`bundle exec ruby extconf.rb`
|
|
27
|
-
`make`
|
|
28
|
-
`cp client.#{extension} ../lib/amq/protocol/native/`
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
RSpec::Core::RakeTask.new("spec") do |spec|
|
|
33
|
-
spec.pattern = "spec/**/*_spec.rb"
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
RSpec::Core::RakeTask.new("clean_spec") do |spec|
|
|
37
|
-
spec.pattern = "spec/**/*_spec.rb"
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
task :compile do
|
|
41
|
-
compile!
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
task :clean do
|
|
45
|
-
puts "Cleaning out native extensions..."
|
|
46
|
-
begin
|
|
47
|
-
Dir.chdir(Pathname(__FILE__).dirname + "lib/amq-protocol/native") do
|
|
48
|
-
`rm client.#{extension}`
|
|
49
|
-
end
|
|
50
|
-
rescue Exception => e
|
|
51
|
-
puts e.message
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
task :default => [:compile, :spec, :clean, :clean_spec]
|
data/amq-protocol.gemspec
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env gem build
|
|
2
|
-
# encoding: utf-8
|
|
3
|
-
|
|
4
|
-
require "base64"
|
|
5
|
-
|
|
6
|
-
require File.expand_path("../lib/amq/protocol/version", __FILE__)
|
|
7
|
-
|
|
8
|
-
Gem::Specification.new do |s|
|
|
9
|
-
s.name = "amq-protocol"
|
|
10
|
-
s.version = AMQ::Protocol::VERSION
|
|
11
|
-
s.authors = ["Jakub Stastny", "Michael S. Klishin", "Theo Hultberg", "Mark Abramov"]
|
|
12
|
-
s.homepage = "http://github.com/ruby-amqp/amq-protocol"
|
|
13
|
-
s.summary = "AMQP 0.9.1 encoding & decoding library."
|
|
14
|
-
s.description = <<-DESC
|
|
15
|
-
amq-protocol is an AMQP 0.9.1 serialization library for Ruby. It is not a
|
|
16
|
-
client: the library only handles serialization and deserialization.
|
|
17
|
-
DESC
|
|
18
|
-
s.email = ["michael.s.klishin@gmail.com"]
|
|
19
|
-
s.licenses = ["MIT"]
|
|
20
|
-
s.required_ruby_version = Gem::Requirement.new(">= 2.2")
|
|
21
|
-
|
|
22
|
-
# files
|
|
23
|
-
s.files = `git ls-files`.split("\n").reject { |file| file =~ /^vendor\// }
|
|
24
|
-
s.require_paths = ["lib"]
|
|
25
|
-
|
|
26
|
-
s.extra_rdoc_files = ["README.md"] + Dir.glob("doc/*")
|
|
27
|
-
end
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# encoding: utf-8
|
|
3
|
-
# frozen_string_literal: true
|
|
4
|
-
|
|
5
|
-
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
|
|
6
|
-
|
|
7
|
-
require "amq/protocol/client"
|
|
8
|
-
require "benchmark/ips"
|
|
9
|
-
|
|
10
|
-
puts
|
|
11
|
-
puts "-" * 80
|
|
12
|
-
puts "Frame Encoding Benchmarks on #{RUBY_DESCRIPTION}"
|
|
13
|
-
puts "-" * 80
|
|
14
|
-
|
|
15
|
-
# Test data
|
|
16
|
-
SMALL_PAYLOAD = "x" * 100
|
|
17
|
-
MEDIUM_PAYLOAD = "x" * 1024
|
|
18
|
-
LARGE_PAYLOAD = "x" * 16384
|
|
19
|
-
|
|
20
|
-
CHANNEL = 1
|
|
21
|
-
|
|
22
|
-
Benchmark.ips do |x|
|
|
23
|
-
x.config(time: 5, warmup: 2)
|
|
24
|
-
|
|
25
|
-
x.report("Frame.encode(:method, small)") do
|
|
26
|
-
AMQ::Protocol::Frame.encode(:method, SMALL_PAYLOAD, CHANNEL)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
x.report("Frame.encode(:method, medium)") do
|
|
30
|
-
AMQ::Protocol::Frame.encode(:method, MEDIUM_PAYLOAD, CHANNEL)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
x.report("Frame.encode(:body, large)") do
|
|
34
|
-
AMQ::Protocol::Frame.encode(:body, LARGE_PAYLOAD, CHANNEL)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
x.report("MethodFrame.new + encode") do
|
|
38
|
-
frame = AMQ::Protocol::MethodFrame.new(SMALL_PAYLOAD, CHANNEL)
|
|
39
|
-
frame.encode
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
x.report("BodyFrame.new + encode") do
|
|
43
|
-
frame = AMQ::Protocol::BodyFrame.new(MEDIUM_PAYLOAD, CHANNEL)
|
|
44
|
-
frame.encode
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
x.report("HeartbeatFrame.encode") do
|
|
48
|
-
AMQ::Protocol::HeartbeatFrame.encode
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
x.compare!
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
puts
|
|
55
|
-
puts "-" * 80
|
|
56
|
-
puts "Frame Header Decoding"
|
|
57
|
-
puts "-" * 80
|
|
58
|
-
|
|
59
|
-
# Encoded frame headers
|
|
60
|
-
METHOD_HEADER = [1, 0, 1, 0, 0, 0, 100].pack("CnN") # type=1, channel=1, size=100
|
|
61
|
-
BODY_HEADER = [3, 0, 5, 0, 0, 16, 0].pack("CnN") # type=3, channel=5, size=4096
|
|
62
|
-
|
|
63
|
-
Benchmark.ips do |x|
|
|
64
|
-
x.config(time: 5, warmup: 2)
|
|
65
|
-
|
|
66
|
-
x.report("Frame.decode_header (method)") do
|
|
67
|
-
AMQ::Protocol::Frame.decode_header(METHOD_HEADER)
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
x.report("Frame.decode_header (body)") do
|
|
71
|
-
AMQ::Protocol::Frame.decode_header(BODY_HEADER)
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
x.compare!
|
|
75
|
-
end
|
data/benchmarks/int_allocator.rb
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
|
|
2
|
-
|
|
3
|
-
require 'amq/int_allocator'
|
|
4
|
-
require "benchmark"
|
|
5
|
-
|
|
6
|
-
allocator = AMQ::IntAllocator.new(1,65535)
|
|
7
|
-
mutex = Mutex.new
|
|
8
|
-
|
|
9
|
-
Benchmark.bm do |x|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
x.report("allocate") do
|
|
13
|
-
allocator = AMQ::IntAllocator.new(1,65535)
|
|
14
|
-
1.upto(65534) do |i|
|
|
15
|
-
mutex.synchronize do
|
|
16
|
-
n = allocator.allocate
|
|
17
|
-
raise 'it be broke' unless n == i
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
x.report("allocate_with_release") do
|
|
23
|
-
allocator = AMQ::IntAllocator.new(1,65535)
|
|
24
|
-
1.upto(65534) do |i|
|
|
25
|
-
mutex.synchronize do
|
|
26
|
-
n = allocator.allocate
|
|
27
|
-
if i % 5 == 0
|
|
28
|
-
allocator.release(n)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
end
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# encoding: utf-8
|
|
3
|
-
# frozen_string_literal: true
|
|
4
|
-
|
|
5
|
-
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
|
|
6
|
-
|
|
7
|
-
require "amq/protocol/client"
|
|
8
|
-
require "benchmark/ips"
|
|
9
|
-
|
|
10
|
-
puts
|
|
11
|
-
puts "-" * 80
|
|
12
|
-
puts "AMQP Method Encoding/Decoding Benchmarks on #{RUBY_DESCRIPTION}"
|
|
13
|
-
puts "-" * 80
|
|
14
|
-
|
|
15
|
-
FRAME_SIZE = 131072 # 128KB, typical default
|
|
16
|
-
|
|
17
|
-
# Common message properties
|
|
18
|
-
BASIC_PROPERTIES = {
|
|
19
|
-
content_type: "application/json",
|
|
20
|
-
delivery_mode: 2,
|
|
21
|
-
priority: 0,
|
|
22
|
-
headers: { "x-custom" => "value" }
|
|
23
|
-
}.freeze
|
|
24
|
-
|
|
25
|
-
MINIMAL_PROPERTIES = {
|
|
26
|
-
delivery_mode: 2
|
|
27
|
-
}.freeze
|
|
28
|
-
|
|
29
|
-
# Payloads
|
|
30
|
-
SMALL_BODY = '{"id":1}'.freeze
|
|
31
|
-
MEDIUM_BODY = ('x' * 1024).freeze
|
|
32
|
-
LARGE_BODY = ('x' * 65536).freeze
|
|
33
|
-
|
|
34
|
-
puts "=== Basic.Publish (Full Message Encoding) ==="
|
|
35
|
-
puts "This is the critical hot path for publishing messages"
|
|
36
|
-
puts
|
|
37
|
-
|
|
38
|
-
Benchmark.ips do |x|
|
|
39
|
-
x.config(time: 5, warmup: 2)
|
|
40
|
-
|
|
41
|
-
x.report("Publish small (8B) + minimal props") do
|
|
42
|
-
AMQ::Protocol::Basic::Publish.encode(
|
|
43
|
-
1, # channel
|
|
44
|
-
SMALL_BODY, # payload
|
|
45
|
-
MINIMAL_PROPERTIES,
|
|
46
|
-
"", # exchange
|
|
47
|
-
"test.queue", # routing_key
|
|
48
|
-
false, # mandatory
|
|
49
|
-
false, # immediate
|
|
50
|
-
FRAME_SIZE
|
|
51
|
-
)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
x.report("Publish small (8B) + full props") do
|
|
55
|
-
AMQ::Protocol::Basic::Publish.encode(
|
|
56
|
-
1,
|
|
57
|
-
SMALL_BODY,
|
|
58
|
-
BASIC_PROPERTIES,
|
|
59
|
-
"",
|
|
60
|
-
"test.queue",
|
|
61
|
-
false,
|
|
62
|
-
false,
|
|
63
|
-
FRAME_SIZE
|
|
64
|
-
)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
x.report("Publish medium (1KB) + full props") do
|
|
68
|
-
AMQ::Protocol::Basic::Publish.encode(
|
|
69
|
-
1,
|
|
70
|
-
MEDIUM_BODY,
|
|
71
|
-
BASIC_PROPERTIES,
|
|
72
|
-
"",
|
|
73
|
-
"test.queue",
|
|
74
|
-
false,
|
|
75
|
-
false,
|
|
76
|
-
FRAME_SIZE
|
|
77
|
-
)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
x.report("Publish large (64KB) + full props") do
|
|
81
|
-
AMQ::Protocol::Basic::Publish.encode(
|
|
82
|
-
1,
|
|
83
|
-
LARGE_BODY,
|
|
84
|
-
BASIC_PROPERTIES,
|
|
85
|
-
"",
|
|
86
|
-
"test.queue",
|
|
87
|
-
false,
|
|
88
|
-
false,
|
|
89
|
-
FRAME_SIZE
|
|
90
|
-
)
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
x.compare!
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
# Create sample encoded methods for decoding benchmarks
|
|
97
|
-
puts
|
|
98
|
-
puts "=== Method Decoding ==="
|
|
99
|
-
|
|
100
|
-
# Simulate encoded Basic.Deliver frame payload (after class/method ID)
|
|
101
|
-
# Basic.Deliver: consumer_tag(shortstr), delivery_tag(longlong), redelivered(bit), exchange(shortstr), routing_key(shortstr)
|
|
102
|
-
def make_deliver_payload(consumer_tag, delivery_tag, exchange, routing_key)
|
|
103
|
-
buffer = String.new(encoding: 'BINARY')
|
|
104
|
-
buffer << consumer_tag.bytesize.chr
|
|
105
|
-
buffer << consumer_tag
|
|
106
|
-
buffer << AMQ::Pack.pack_uint64_big_endian(delivery_tag)
|
|
107
|
-
buffer << "\x00" # redelivered = false
|
|
108
|
-
buffer << exchange.bytesize.chr
|
|
109
|
-
buffer << exchange
|
|
110
|
-
buffer << routing_key.bytesize.chr
|
|
111
|
-
buffer << routing_key
|
|
112
|
-
buffer
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
DELIVER_PAYLOAD_SHORT = make_deliver_payload("ctag", 1, "", "q")
|
|
116
|
-
DELIVER_PAYLOAD_TYPICAL = make_deliver_payload("bunny-consumer-12345", 999999, "amq.topic", "events.user.created")
|
|
117
|
-
|
|
118
|
-
Benchmark.ips do |x|
|
|
119
|
-
x.config(time: 5, warmup: 2)
|
|
120
|
-
|
|
121
|
-
x.report("Basic.Deliver.decode (short)") do
|
|
122
|
-
AMQ::Protocol::Basic::Deliver.decode(DELIVER_PAYLOAD_SHORT)
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
x.report("Basic.Deliver.decode (typical)") do
|
|
126
|
-
AMQ::Protocol::Basic::Deliver.decode(DELIVER_PAYLOAD_TYPICAL)
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
x.compare!
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
puts
|
|
133
|
-
puts "=== Properties Encoding/Decoding ==="
|
|
134
|
-
|
|
135
|
-
Benchmark.ips do |x|
|
|
136
|
-
x.config(time: 5, warmup: 2)
|
|
137
|
-
|
|
138
|
-
x.report("encode_properties (minimal)") do
|
|
139
|
-
AMQ::Protocol::Basic.encode_properties(100, MINIMAL_PROPERTIES)
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
x.report("encode_properties (full)") do
|
|
143
|
-
AMQ::Protocol::Basic.encode_properties(1024, BASIC_PROPERTIES)
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
x.compare!
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
# Create encoded properties for decode benchmark
|
|
150
|
-
ENCODED_MINIMAL_PROPS = AMQ::Protocol::Basic.encode_properties(100, MINIMAL_PROPERTIES)
|
|
151
|
-
ENCODED_FULL_PROPS = AMQ::Protocol::Basic.encode_properties(1024, BASIC_PROPERTIES)
|
|
152
|
-
|
|
153
|
-
# Skip the first 12 bytes (class_id, weight, body_size)
|
|
154
|
-
PROPS_DATA_MINIMAL = ENCODED_MINIMAL_PROPS[12..-1]
|
|
155
|
-
PROPS_DATA_FULL = ENCODED_FULL_PROPS[12..-1]
|
|
156
|
-
|
|
157
|
-
Benchmark.ips do |x|
|
|
158
|
-
x.config(time: 5, warmup: 2)
|
|
159
|
-
|
|
160
|
-
x.report("decode_properties (minimal)") do
|
|
161
|
-
AMQ::Protocol::Basic.decode_properties(PROPS_DATA_MINIMAL)
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
x.report("decode_properties (full)") do
|
|
165
|
-
AMQ::Protocol::Basic.decode_properties(PROPS_DATA_FULL)
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
x.compare!
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
puts
|
|
172
|
-
puts "=== Other Common Methods ==="
|
|
173
|
-
|
|
174
|
-
Benchmark.ips do |x|
|
|
175
|
-
x.config(time: 5, warmup: 2)
|
|
176
|
-
|
|
177
|
-
x.report("Basic.Ack.encode") do
|
|
178
|
-
AMQ::Protocol::Basic::Ack.encode(1, 12345, false)
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
x.report("Basic.Nack.encode") do
|
|
182
|
-
AMQ::Protocol::Basic::Nack.encode(1, 12345, false, true)
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
x.report("Basic.Reject.encode") do
|
|
186
|
-
AMQ::Protocol::Basic::Reject.encode(1, 12345, true)
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
x.report("Queue.Declare.encode") do
|
|
190
|
-
AMQ::Protocol::Queue::Declare.encode(1, "test.queue", false, true, false, false, false, {})
|
|
191
|
-
end
|
|
192
|
-
|
|
193
|
-
x.report("Exchange.Declare.encode") do
|
|
194
|
-
AMQ::Protocol::Exchange::Declare.encode(1, "test.exchange", "topic", false, true, false, false, false, {})
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
x.compare!
|
|
198
|
-
end
|