Fine-tuning memory use of wiremock instances

1,973 views
Skip to first unread message

Raffaele Litto

unread,
Jul 17, 2017, 8:27:12 AM7/17/17
to wiremock-user
Hello, I am testing the possibility of using wiremock to simulate some of our APIs
It is possible to fine tune the java -jar wiremock call to reduce its memory footprint?
How it is on docker? I have started it in a dockerised image, and I see a lot of CPU usage using ctop

Do you have suggestions to optimise it?

Tom Akehurst

unread,
Jul 17, 2017, 8:34:37 AM7/17/17
to wiremock-user
You can cap the size of the request journal, which helps keep the heap footprint fairly small.

Works fine in docker, although I've heard in the last couple of days that running it for long periods with the --verbose flag can lead to problems.

Are you seeing high CPU when it's idle? If not, what kind of workload?

Raffaele Litto

unread,
Jul 17, 2017, 11:42:27 AM7/17/17
to wiremo...@googlegroups.com
What level of request journal capping I should use?
I am running a comparison between Wiremock and Hoverfly for my company, and since our principal use for this use case will be to stub api responses, I want to reduce unnecessary use of resources.
Plus, do you suggest that while running with java -jar or within docker I could apply some command line optimisations for the JVM?

The high CPU peak was while running wiremock inside docker-compose: using ctop for about two minutes I saw CPU usage going to 90+% and then it went down to 0-1%, but I was not sending any requests.
The only peculiar thing I did is to share __files and mappings as volumes outside the docker-compose, so I could access them. Do you think it could be this the reason?

Thanks

Raffaele

Raffaele Litto
Software Architect

MOVE Guides
Mobility Made Easy

6 Ramillies Street, 
London, W1F 7TY

Mobile: +44 74 42827125
EMail: raff...@moveguides.com
@cantoredombre

 


--
You received this message because you are subscribed to a topic in the Google Groups "wiremock-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wiremock-user/f27dlFr4N5I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wiremock-user+unsubscribe@googlegroups.com.
To post to this group, send email to wiremo...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/wiremock-user/a9774a49-d5b9-443a-9630-bcee70565105%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Tom Akehurst

unread,
Jul 17, 2017, 12:12:07 PM7/17/17
to wiremock-user
WireMock scans and loads everything under the mappings dir on startup, so this might have explained the CPU usage spike to you saw.

The request journal cap bound is set in terms of the number of items, so the appropriate level depends on your use case. If you don't care about using it for verification or browsing it for debugging purposes, you could turn it off completely.

I've never personally had cause to try and optimise a running WireMock instance, so I can only speak generally about resource usage. Again, it depends on your use case - if you've turned off the request journal and you've only got a small number of stubs then you shouldn't need much memory. Once you've got over the initial startup period (and a bit of JVM warmup), CPU requirements should also be pretty modest provided you're not load testing. Exactly how little of each you need I couldn't say, so I suggest experimenting with what you'd consider reasonable settings and see if you get satisfactory performance.

Raffaele Litto

unread,
Jul 19, 2017, 5:09:55 AM7/19/17
to wiremo...@googlegroups.com
Thank you for the tips and your time!



Reply all
Reply to author
Forward
Message has been deleted
0 new messages