# Launch Options

These are special settings that allow you to optimize the launch and operation of the server in the future.

{% hint style="warning" %}
Be sure to keep in mind that the arguments should be selected individually for the server hardware, as well as the **Java** version.
{% endhint %}

Let's start with a small example:

<pre><code><strong>java -jar server.jar
</strong></code></pre>

This is the most common script for running the server kernel, which does not specify any additional arguments.

## Now about the parameters themselves

**-jar** — this argument specifies the type of **Java file** to run.

**name.jar** — the name of the file to run.

**nogui** — it runs the server without a graphical interface, because we simply do not need it.

## The main flags

**-xincgc** - activates the «**‎**garbage collector», which from time to time will unload unused **RAM**. The collector type is automatically selected depending on the **Java** version.

**-server** - activates the server version of **Java**, which by default includes support for experimental flags. It also speeds up class compilation, which increases performance but increases server start time (only **64-bit systems** are supported).

## Allocation of RAM

{% hint style="info" %}
The arguments support both «**M** » for megabytes as well as «**G**» for gigabytes. For example, the **Xms2G** argument will start a server with **2 gigabytes** of **RAM**.
{% endhint %}

**-Xmx0000M** — the amount of maximum allocated memory for the server.

**-Xms0000M** — the amount of minimum allocated memory for the server.

**-Xmn0000M** — the amount of memory allocated for temporary objects

**-XX:MaxPermSize=0000M** — the amount of memory for **PermGen Space** (does not work on **Java 8**).

**-XX:SharedReadOnlySize=0000M** — the amount of memory **under read-only** is the space in PermGen.

## Collectors of various «garbage»

\
\&#xNAN;**-XX:+UseSerialGC** — enables the garbage collector, which runs on the 1st thread.

-**XX:+UseConcMarkSweepGC** —includes a garbage collector that uses the power of multiple processor cores.

**-XX:ConcGCThreads=2** — the number of threads for the garbage collector.

**-XX:+UseG1GC** — activates a new garbage collector, which divides all memory into specific sections, and, thanks to the use of multiple cores, collects unused memory from all sections.

-**XX:G1HeapRegionSize=32** — the amount of RAM allocated for each section.

**-XX:AutoGCSelectPauseMillis=2500** — the amount of time in milliseconds between calling the automatically selected garbage collector.

**-XX:MaxGCPauseMillis=1000** —the length of time in milliseconds between calling a specific the garbage collector. For G1, GC plays the role of the maximum set interval.

**-XX:SurvivorRatio=8** — the number of radius for the existence of surviving objects (the smaller the number, the more space). A larger location allows newly generated objects to exist longer before garbage collection.

**-XX:TargetSurvivorRatio=90** — the amount of space as a percentage for surviving objects, which will allow you to clean up more unused objects during garbage collection.

**-XX:+UseBiasedLocking** — acceleration of object synchronization on multi-core processors.

**-XX:+UseFastAccessorMethods** — using optimized versions of method calls.

-**XX:+UseFastEmptyMethods** — exclusion of empty methods from compilation.

**XX:+UseCompressedOops** — reducing the size of the pointer, headers, and shifts inside the created objects. Depending on the code, it will save 20-60% of RAM.

In general, we got a similar script to run the server:

```
java -Xincgc -Xms512M -Xmx4G -XX:MaxPermSize=128M -XX:SharedReadOnlySize=30M -XX:+UseConcMarkSweepGC -XX:+UseBiasedLocking -XX:+UseFastAccessorMethods -XX:+UseCompressedOops -jar server.jar nogui
```
