Confluence memory tuning - sychrony failing -
Asked by Patrick Unthank:

Hi,

We have a confluence server on VM running 6.15.10 with the memory parameters set as -Xms4g -Xmx8g from a server with 32GB RAM. We have tuned this in May (blue circle) from -Xms16g -Xmx16g and has been working well, not it seems to be using swap more and not releasing (orange circle). Garbage collection seems to be the initiator or event that provokes the issue. What we then see is banners from synchrony stating that collaborative editing is being affected when editing pages. When trouble shooting we can see error is reported in the collaborative editing admin page. There is not a viable option to turn collaborative editing off as it is needed (or there will be complaints from users), limited could be an option, on is where we are now. I see that there is a parameter for sychrony itself (-Xmx1g) but am leaning towards increasing the max memory parameter for confluence java process to 10 or 12g.

Has anyone else experienced this scenario? What did you do? What can you advise?

TIA

![wiki-prod-graph-synchrony-swap.jpg](/t5/image/serverpage/image-id/101580i9E15D13443936C02/image-size/large?v=v2&px=999 "wiki-prod-graph-synchrony-swap.jpg")


Answers:
author: Daniel Eads
body: Hi Patrick,

Our [performance tuning guide](https://confluence.atlassian.com/doc/performance-tuning-130289.html) (a good resource to read if you haven't already) has some general guidance to increase the heap if you're seeing a lot of swapping. Based on the activity you see starting around 6/21 at your orange circle, I'd say it's likely a heap increase would be useful. [I've also written in the past about GC / heap](https://community.atlassian.com/t5/Confluence-questions/Re-Confluence-memory-usage/qaq-p/1108290/comment-id/145518#M145518) if you're interested in a little more reading.

If you've got [garbage collection logging enabled](https://confluence.atlassian.com/confkb/how-to-enable-garbage-collection-gc-logging-300813751.html) you can use the timestamps to confirm that a full garbage collect (system.gc in the log) occurs at the time that swap increases. Typically a garbage collection stall is also accompanied by an increase in CPU - from your graph it doesn't look like there's a particular spike at the time swap seems to go up. Do you know which garbage collector you're using? This would be configured near the memory parameters.

For G1GC (the garbage collector you'll likely want to be using) the presence of "-XX:+G1GC" indicates G1GC is the selected garbage collector. There's some tuning you can do there (my post above links to some excellent videos on the topic of GC tuning) if necessary but I'd be interested in just knowing which garbage collector is enabled.

As for increasing the Synchrony heap, [that's certainly something you can do](https://confluence.atlassian.com/confkb/how-to-increase-synchrony-heap-allocation-936516650.html) and it appears you have the RAM to support it. Given the swap you are seeing though, I'd take a look at the garbage collector as a first course of action. With memory and heap tuning, it's best to change one thing at a time and measure the results.

If I didn't already talk you into it, I really recommend checking out this [session about performance tuning](https://www.atlassian.com/company/events/summit-us/watch-sessions/2017/scale-atlassian/expecto-performa-the-magic-and-reality-of-performance-tuning) featuring Denise Unterwurzacher from here at Atlassian - there are few people who understand more about tuning Confluence than she does and there is some sage advice throughout that session.

Cheers,  
Daniel


Tags: confluence-server