java - How to make JVM use the max (all remain) memory of a server -


i have dfs algorithm java console application, runs faster when more memory provided. dfs algorithm application, neither i/o nor other outer-jvm resource usage. consumes cpu , memory. application can run 1gb memory, run more faster 2 gb memory. more memory provided, faster application can run. haven't touch speed limit 12gb of memory provided. must use remain memory of server speed up. , application need not parallel, 1 request @ 1 time.

and need install application on different server different memory size.

is there way let jvm use remain memory of server?

-xx:maxramfraction=1 

maxramfraction not every server good, server result in start jvm failure location memory failure, works good.

use wrapper application system remain memory, , minus memory usage other xmx, start real application same xms , xms. method result in jvm memory allocation error. because code below returns more memory can use, not minus of xss256m or more non-heap jvm memory.

com.sun.management.operatingsystemmxbean mbean = (com.sun.management.operatingsystemmxbean)     managementfactory.getoperatingsystemmxbean(); long size = mbean.getfreephysicalmemorysize(); 

so there way let jvm use remain memory of server?

for large regions of memory use off heap , reduces overhead on gc, 1 of benefitis is can size @ runtime , larger main memory if carefully. can use direct bytebuffers use library wrote extends bytebuffer functionality (>> 2 gb , thread safe) chronicle bytes largest 1 uses ~100 tb of virtual memory mapped disk.

we have 2 data structures on top of chronicle bytes, key-value store chronicle map , queue/journal chronicle queue. can make storing data off heap easier higher level interface.

the way heap works, has reserve maximum heap size on start single continuous block of virtual memory. in particular, gc assumes random access memory on clean means if have on utilised memory, possibly because process started after yours , of heap swapped out see dramatic fall in performance whole machine. windows tends start swapping gui meaning can't control without power cycle. linux isn't bad, want kill process @ point. makes tuning size use memory hard if usage of machine changes.

by using virtual memory comparison, gc doesn't touch unused portions have little impact. can have areas of virtual memory many times main memory current working set matters, , size entirely in control @ runtime. note: on linux can have virtual memory sizes 1000x free disk space, use care, if run out touching many pages program crash.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -