Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Control the speed when publishing messages #23

Open
stiangrindvoll opened this issue Jun 28, 2018 · 13 comments
Open

Control the speed when publishing messages #23

stiangrindvoll opened this issue Jun 28, 2018 · 13 comments

Comments

@stiangrindvoll
Copy link
Collaborator

stiangrindvoll commented Jun 28, 2018

In some cases a consumer has specific needs or limits were the consumption rate would need to be constant or at least more controllable. By adding limits to the publishing speed, we will be able to support the specific needs of the consumer.

@spier spier changed the title control the speed when publishing messages Control the speed when publishing messages Dec 31, 2018
@spier
Copy link
Contributor

spier commented Dec 31, 2018

Why? :)

@TafThorne
Copy link

I could do with this too.

The service I am trying to test expects about 1 message a second. Adding a pacing option might help me more closely replicate what I record. As the messages I am dealing with contain timestamps there is some checking to ensure the time is passing at believable rate.

@TafThorne
Copy link

I will see if I can get together a working change for next week. Looks simple enough to add some kind of delay in the Publish function.

@spier
Copy link
Contributor

spier commented May 11, 2019

@TafThorne how would you want the CLI options to look like?

Maybe similar to what the load testing tool vegeta does? i.e.

  -rate value
    	Number of requests per time unit (default 50/1s)

Also what did you mean by this?

ensure the time is passing at believable rate

@TafThorne
Copy link

TafThorne commented May 13, 2019 via email

@spier
Copy link
Contributor

spier commented May 13, 2019

Sounds great! @stiangrindvoll and I actually work for the same company, so if you need any help I can walk over to him and make sure he sees this thread :)

@TafThorne would you be willing to take a first pass at this feature and the send a PR, even if its in a semi-finished state? Then we can help to bring it over the finish line.

@TafThorne
Copy link

TafThorne commented May 13, 2019 via email

@stevenklassen8376
Copy link

I have a need that is similar, but not identical to, this request. Specifically I need to simulate something close to a real-time system. That is, I need a playback that uses about the same timing as the recordings. Essentially I would like something where I specify the speed as a multiple of real time such as 1x, 2x, 3x, and so on as well as a "as fast as possible" which would essentially be what it does now.

@stevenklassen8376
Copy link

stevenklassen8376 commented May 27, 2019

Looks like my request could not be handled in the general sense since even if the timestamp header is set, it does not seem to get recorded. I just ran a test where I made sure I set the timestamp, and I get the following when I consume the message in Pika:

<BasicProperties(['content_type=application/json', 'timestamp=1558966913'])>

but these values do not seem to get stored in the recording.

$ gunzip - < recordings/1_messages_1.tgz | pax
pax: Unrecognized header keyword: SCHILY.xattr.RABBITIO.amqp.routingkey
1b98c374-6930-47c9-b901-cb64faa907ba.rio

So, unless I'm missing something, there isn't enough information recorded in order to perform a realtime simulation.

@stiangrindvoll
Copy link
Collaborator Author

stiangrindvoll commented Jun 13, 2019

@stevenklassen8376 To try to understand your usecase:

  • Store original amqp timestamp
  • Use this timestamp to calculate the delay between messages
  • Publish based on this delay (1x)
  • Ability to speed it up 1x, 2x, 3x

This seem to assume that messages are in chronological order already.

This is a little more complicated than just adding an overall rate or delay, where the timestamp is not needed. And deserves a separate issue to this one i feel.

@stevenklassen8376
Copy link

Understood. I have actually gone with another tool so don't add a new issue on my account.

@stiangrindvoll
Copy link
Collaborator Author

What tool did you find to solve your use case @stevenklassen8376 ?

@stevenklassen8376
Copy link

https://github.com/jandelgado/rabtap

It doesn't solve it either, but is closer so I've added the feature request there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants