11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

the signature of the jar that you got in Step 4.<br />

curl http://localhost:8983/solr/techproducts/config -H<br />

'Content-type:application/json' -d '{<br />

"add-runtimelib": {<br />

"name":"blobname",<br />

"version":2,<br />

"sig":"mW1Gwtz2QazjfVdrLFHfbGwcr8xzFYgUOLu68LHqWRDvLG0uLcy1McQ+AzVmeZFBf1yLPDEHBWJb5<br />

KXr8bdbHN/<br />

PYgUB1nsr9pk4EFyD9KfJ8TqeH/ijQ9waa/vjqyiKEI9U550EtSzruLVZ32wJ7smvV0fj2YYhrUaaPzOn9g0<br />

=" }<br />

}'<br />

JVM Settings<br />

Configuring your JVM can be a complex topic. A full discussion is beyond the scope of this document. Luckily,<br />

most modern JVMs are quite good at making the best use of available resources with default settings. The<br />

following sections contain a few tips that may be helpful when the defaults are not optimal for your situation.<br />

For more general information about improving <strong>Solr</strong> performance, see https://wiki.apache.org/solr/<strong>Solr</strong>Performanc<br />

eFactors.<br />

Choosing Memory Heap Settings<br />

The most important JVM configuration settings are those that determine the amount of memory it is allowed to<br />

allocate. There are two primary command-line options that set memory limits for the JVM. These are -Xms,<br />

which sets the initial size of the JVM's memory heap, and -Xmx, which sets the maximum size to which the heap<br />

is allowed to grow.<br />

If your <strong>Solr</strong> application requires more heap space than you specify with the -Xms option, the heap will grow<br />

automatically. It's quite reasonable to not specify an initial size and let the heap grow as needed. The only<br />

downside is a somewhat slower startup time since the application will take longer to initialize. Setting the initial<br />

heap size higher than the default may avoid a series of heap expansions, which often results in objects being<br />

shuffled around within the heap, as the application spins up.<br />

The maximum heap size, set with -Xmx, is more critical. If the memory heap grows to this size, object creation<br />

may begin to fail and throw OutOfMemoryException. Setting this limit too low can cause spurious errors in<br />

your application, but setting it too high can be detrimental as well.<br />

It doesn't always cause an error when the heap reaches the maximum size. Before an error is raised, the JVM<br />

will first try to reclaim any available space that already exists in the heap. Only if all garbage collection attempts<br />

fail will your application see an exception. As long as the maximum is big enough, your app will run without error,<br />

but it may run more slowly if forced garbage collection kicks in frequently.<br />

The larger the heap the longer it takes to do garbage collection. This can mean minor, random pauses or, in<br />

extreme cases, "freeze the world" pauses of a minute or more. As a practical matter, this can become a serious<br />

problem for heap sizes that exceed about two gigabytes, even if far more physical memory is available. On<br />

robust hardware, you may get better results running multiple JVMs, rather than just one with a large memory<br />

heap. Some specialized JVM implementations may have customized garbage collection algorithms that do better<br />

with large heaps. Consult your JVM vendor's documentation.<br />

When setting the maximum heap size, be careful not to let the JVM consume all available physical memory. If<br />

the JVM process space grows too large, the operating system will start swapping it, which will severely impact<br />

performance. In addition, the operating system uses memory space not allocated to processes for file system<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

501

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!