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

Pact-stub-server Multi-threaded #36

Closed
Ajay2020813 opened this issue Jul 11, 2020 · 13 comments
Closed

Pact-stub-server Multi-threaded #36

Ajay2020813 opened this issue Jul 11, 2020 · 13 comments

Comments

@Ajay2020813
Copy link

Hi Team

I was trying to run the pact stub server with multiple instances of the client but i am getting errors related to request timeouts.Looks like PactsubServer is not capable of serving the parallel requests.

I am using swift app with multiple simulators to see the behavior.

Is there any setting/param to be enable to make it support multi-thread?

Any support is appreciated. This is urgent

Thanks

@uglyog
Copy link
Member

uglyog commented Jul 14, 2020

Looks like it was CPU bound (it was only running one thread, and that thread/CPU was being overwhelmed). I have pushed a fix for this.

@Ajay2020813
Copy link
Author

Ajay2020813 commented Jul 14, 2020 via email

@uglyog
Copy link
Member

uglyog commented Jul 14, 2020

0.4.2 has been released with the fix

@Ajay2020813
Copy link
Author

Ajay2020813 commented Jul 15, 2020 via email

@uglyog
Copy link
Member

uglyog commented Jul 15, 2020

How are you running the test, and what is the machine CPU and memory usage while it is running?

I ran a test with 5000 requests per second. This was on the loopback adaptor, so no network was involved.

$ echo 'GET http://127.0.0.1:8080/activities' | vegeta attack -duration=10s -rate=5000 | tee results.bin | vegeta report
Requests      [total, rate, throughput]         50000, 5000.11, 5000.00
Duration      [total, attack, wait]             10s, 10s, 226.018µs
Latencies     [min, mean, 50, 90, 95, 99, max]  119.339µs, 385.528µs, 218.218µs, 274.204µs, 311.223µs, 4.859ms, 39.723ms
Bytes In      [total, mean]                     8200000, 164.00
Bytes Out     [total, mean]                     0, 0.00
Success       [ratio]                           100.00%
Status Codes  [code:count]                      200:50000

By default, it will use 1 thread per CPU core plus one, so on my laptop it would use 13 threads. Your machine will be different.

@Ajay2020813
Copy link
Author

Ajay2020813 commented Jul 15, 2020 via email

@Ajay2020813
Copy link
Author

Ajay2020813 commented Jul 15, 2020 via email

@Ajay2020813
Copy link
Author

Ajay2020813 commented Jul 15, 2020 via email

@uglyog
Copy link
Member

uglyog commented Jul 15, 2020

Unfortunately, I only get to work on this project in my spare time.

Can you explain what you are trying to achieve. The stub server was written to support prototyping new consumers, and not for performance testing. How many requests per second are you making to it, and what is the CPU and memory load of the machine while you are running the test?

@uglyog
Copy link
Member

uglyog commented Jul 16, 2020

If you have a pact file with 1000 interactions, the stub server will have to match every incoming request against 1000 possible ones. That is a lot of work it has to do.

@uglyog
Copy link
Member

uglyog commented Jul 16, 2020

dial tcp 0.0.0.0:0->127.0.0.1:9992: socket: too many open files probably means your terminal is not handling the amount of console output. You need to turn off the logging with the stub server if you want to run this type of load.

@uglyog
Copy link
Member

uglyog commented Jul 26, 2020

I've done some performance enhancements. HTTP keep alive was disabled, so that might have been causing the timeouts. Try version 0.4.3 and see how it goes.

@Ajay2020813
Copy link
Author

Ajay2020813 commented Jul 26, 2020 via email

@uglyog uglyog closed this as completed Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants