Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support simulations with callback vs. just return values #36

Closed
eslick opened this issue Oct 7, 2016 · 2 comments
Closed

Support simulations with callback vs. just return values #36

eslick opened this issue Oct 7, 2016 · 2 comments
Labels

Comments

@eslick
Copy link

eslick commented Oct 7, 2016

I have a web system that I want to load test and evaluate for its end to end performance where the request starts off a process, but the actual transaction is completed only when the system POSTs to a URL endpoint. We're interested in getting a sense of both latency and throughput for the GET -> POST response transaction. Is there a clean way to implement this, or do you have suggestions for a patch I could submit? We've been looking at doing something more ad-hoc on top of Riemann, but intrigued by your approach here.

@mhjort
Copy link
Owner

mhjort commented Oct 9, 2016

I think this is something that can be implemented with clj-gatling out-of-the box. In addition to returning the value directly you can return core.async channel which you can later on write to. Solution looks something like this:

Your clj-gatling request function.

(defn request []
  (let [return-channel (async/chan)
        identifier (do-get-request)]
    (register-identifier! identifier return-channel)
    return-channel)))

So in here I am assuming you have some kind of a way for identifying requests. Later on that can be used to connect them to correct POST responses. For registering you can use for example atom to store. Then you need a http server (e.g. http-kit or Jetty) running in same process. Your post handler should look like this:

(defn post-handler [identifier]
  (let [return-channel (get-from-register identifier)]
    (>!! return-channel true)))

So in here you get correct return-channel from registry and write the result to that channel.

Does this make sense?

@mhjort mhjort added the question label Oct 9, 2016
@eslick
Copy link
Author

eslick commented Oct 12, 2016

Great suggestion, thank you. I was able to accomplish that without too much trouble.

@eslick eslick closed this as completed Oct 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants