Boondoggle
Member
Just to quickly list optimizations that I am playing with in my script that I have been finding help A LOT:
1) CPU optimization - Out of the box most CPU's are set in a powersave mode on some or all cores. You can use utilities to set this to "performance" mode. Additionally some BIOS settings allow you to force your CPU's to be in this mode constantly.
2) localhost settings - Wherever your hosts are setup (linux is /etc/hosts) make sure you have an entry that ties 127.0.0.1 to localhost to your HOSTNAME.
3) Setup BBR - instead of using Reno or Cubic congestion Control algorithms switch to BBR, this algorithm was developed by google to maximize throughput in network congestion scenarios (helps with all the calls to KoL's servers)
4) Verify DNS settings - make sure you are using a good DNS. Generally when on a LAN or even with your ISP you will be redirected to their DNS, then they use google's DNS. If you directly change your DNS servers to use google's (8.8.8.8 and 8.8.4.4) your name resolution for KoL hits will be faster.
5) Turn off IPv6 support - (WARNING: if this is a company computer, or used in an application that uses IPv6 this may cause problems) Turing off IPv6 support in both your browser and the system itself can improve the relay aspect of KoLMafia (notably in Firefox, possibly Chrome)
6) Java optimization - You can change the parameters that JVM launches with. Notably:
-Xmx This is the maximum amount memory java can use and shouldn't generally be more than 1/2 your free memory. 512M is a decent setting, I've seen mine hit just under 2G with my settings. This must be an integer and reflect proper memory increments. Example: -Xmx2G or -Xmx2048M
-Xms This is the initial amount of memory java uses, it will then incrementally scale up to the -Xmx setting. Unfortunately there is a small amount of performance loss during scaling, for speed it is best to set -Xms the same as -Xmx. Example: -Xms2G or -Xms2048M
-Xmn This is where new objects in Java start, live, and maybe die. This IS usually a calculated number, but you can set it yourself. Usually 1/4 to 1/3 of -Xmx is an accepted value and must also reflect proper memory increments. Example: -Xmn512M
-XX:+/-DisableExplicitGC This will disable/enable KoLMafia from deliberately calling for Garbage Collection (clean up of unused objects in memory). by default this is off (-XX:-DisableExplicitGC) if you are allocating 1G of memory or more in -Xmx you should be able to safely disable this (-XX:+DisableExplicitGC) which can eliminate otherwise unnecessary pauses, and allow the system to clean up when it feels necessary.
Java 7 or higher:
Anyways. This is what I have been plying with and researching over the last few days. If anyone else has any comments let me know.
1) CPU optimization - Out of the box most CPU's are set in a powersave mode on some or all cores. You can use utilities to set this to "performance" mode. Additionally some BIOS settings allow you to force your CPU's to be in this mode constantly.
2) localhost settings - Wherever your hosts are setup (linux is /etc/hosts) make sure you have an entry that ties 127.0.0.1 to localhost to your HOSTNAME.
3) Setup BBR - instead of using Reno or Cubic congestion Control algorithms switch to BBR, this algorithm was developed by google to maximize throughput in network congestion scenarios (helps with all the calls to KoL's servers)
4) Verify DNS settings - make sure you are using a good DNS. Generally when on a LAN or even with your ISP you will be redirected to their DNS, then they use google's DNS. If you directly change your DNS servers to use google's (8.8.8.8 and 8.8.4.4) your name resolution for KoL hits will be faster.
5) Turn off IPv6 support - (WARNING: if this is a company computer, or used in an application that uses IPv6 this may cause problems) Turing off IPv6 support in both your browser and the system itself can improve the relay aspect of KoLMafia (notably in Firefox, possibly Chrome)
6) Java optimization - You can change the parameters that JVM launches with. Notably:
-Xmx This is the maximum amount memory java can use and shouldn't generally be more than 1/2 your free memory. 512M is a decent setting, I've seen mine hit just under 2G with my settings. This must be an integer and reflect proper memory increments. Example: -Xmx2G or -Xmx2048M
-Xms This is the initial amount of memory java uses, it will then incrementally scale up to the -Xmx setting. Unfortunately there is a small amount of performance loss during scaling, for speed it is best to set -Xms the same as -Xmx. Example: -Xms2G or -Xms2048M
-Xmn This is where new objects in Java start, live, and maybe die. This IS usually a calculated number, but you can set it yourself. Usually 1/4 to 1/3 of -Xmx is an accepted value and must also reflect proper memory increments. Example: -Xmn512M
-XX:+/-DisableExplicitGC This will disable/enable KoLMafia from deliberately calling for Garbage Collection (clean up of unused objects in memory). by default this is off (-XX:-DisableExplicitGC) if you are allocating 1G of memory or more in -Xmx you should be able to safely disable this (-XX:+DisableExplicitGC) which can eliminate otherwise unnecessary pauses, and allow the system to clean up when it feels necessary.
Java 7 or higher:
You can use the more optimized G1 Garbage Collector with the following settings:
Java 6 or lower:
Code:
-XX:+UseG1GC -XX:+AlwaysPreTouch -XX:+ParallelRefProcEnabled
You can use CMS Garbage collector with the following settings:
(### = 40 (Default) if you are running -Xmx of 512M, or 68 if you are above 512M)
Code:
-XX:+UseConcMarkSweepGC -XX:+UseParallelGC -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=###
Anyways. This is what I have been plying with and researching over the last few days. If anyone else has any comments let me know.