Closed msayler closed 4 years ago
I wouldn't expect effect beyond JSON serialization taking less time because columns are filtered out after querying and most of the time is spend loading and aggregating a lot of data that sorting might require.
Fair that it might be equivalent load on the server, but it definitely reduces load on the client when using this library. We measured a 3MB JSON output for /api/queues
returning ~1500 items. The list_queues
call took about 13 seconds of wall clock time at ~100% CPU on a c4.large instance in AWS. After returning only the needed columns, the wall-clock time for the whole process of connect, retrieve, and filter was less than a second.
I'm happy to put a change together, BTW. I just wanted to see whether it had a chance of landing.
I don't have any objections if we can avoid breaking the API.
Fixed by https://github.com/ruby-amqp/rabbitmq_http_api_client/pull/43
client.list_queues(vhost, columns: 'name,messages')
# or for default vhost
client.list_queues(nil, columns: 'name,messages')
Thanks @sharshenov 👍
Per RMQ Management HTTP API:
It would be great if I could, for example, say something like
client.list_queues(:columns=>["name","messages"])
This particular use case can reduce both client and server load when incurred when doing monitoring checks using the client for clusters with 100s or 1000s of queues.