Skip to content

Do not create string objects from consumerTag, exchange and routingKey, or get them from a string cache. #1231

Open
@zgabi

Description

@zgabi

In our real application the most allocated objects are Strings. Most of them are allocated in RabbitMQ Client:

image

They usually contains the same value.

Please consider using ReadOnlySpan<char> or ReadOnlySpan<byte> with a pooled array in the background similar to the data.
Alternatively get the strings from a cache table (maybe separate table for each "string type" (consumerTag, exchange...)), since most of them are the same.

By the way in the screenshot the 3rd, 4th, 5th and 6th allocations also belongs to RabbitMQ Client, but maybe some of them are already solved in the main branch. (I'm using the latest 6.x package)
The 2nd one is WFP, I have a PR for that.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions