Minecraft wiki entry for Setting_up_a_server, associated text: The most important thing for a Minecraft server is memory to run with. Use the -Xmx switch to change how much memory it's allowed to use. -Xmx4G (two gigabytes) is usually more than enough.
-Xms (the initial memory size) does not affect performance in the long run, but you can set it too. -Xms512M should be enough.
When java changes the heap size, it slows down performance, so it is recommended to set -Xmx and -Xms to the same value, for example command: java -Xmx4G -Xms4G ( ... your other java options) -jar ( the name of your server jar, for example server.jar) (your minecraft options)
This would run the server with four gigabytes of RAM.
A "soft max heap size" (-XX:SoftMaxHeapSize=1G) is available for some versions of JRE. The JRE will try to only use that much memory, but will go over to a maximum of -Xmx if necessary. If you are running many things on your server, this may be useful.
Use -d64 if your server is on a 64-bit Solaris system using 64-bit Java.
For optimal performance, use Aikar's flags as your Java options. These flags are generally accepted as the way to get the best, stable performance.