Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Saving RAM across Clients with Class Data Sharing


    Pandemic

    Recommended Posts

    Hey everyone,

    I'd like to start by thanking @notsmile for reminding me of Class Data Sharing (CDS) to minimize resource use when running multiple clients on the same machine.

    What's CDS?

    Basically CDS first makes a list of classes that can safely be mmap'd (shared) across various running processes, saving you precious metaspace (RAM) when running more than one client at a time. With that list of classes, the JVM will know which classes it can safely mmap instead of actually load exclusively, meaning that multiple clients are able to essentially share the same classes on disk without needing to do the extra work of storing a copy.

    Right now we don't have it automated via the launcher, but I might add that in the future. I'm not sure if people using the launcher will really benefit from this as much as heavy users already using CLI.

    Is it worth it?

    I'm not really sure, in a very brief test using a script that just stands around, I saw a metaspace reduction of about 30MB and it ended up sharing 6500/~8500 classes, and that's per client so you could see some real savings if you're running 10/20/100+ clients on the same machine.

    You might see even more savings depending on what your script does, etc. I haven't done much testing at all, so this is more for you guys running a lot of clients to give it a shot and let me know if it's worth pursuing.

    How do I use CDS?

    Create the Shared Archive

    I haven't used this method very long, so I'm not sure how often you'll need to re-run this step, but I'm guessing any DreamBot client updates and any time you change Java versions is a safe bet. If something isn't working when using it, try re-running this step to get a fresh archive. You do not need to do this every time you want to use the archive though, only when generating it.

    First, you need to open a terminal or command prompt, and go to the DreamBot BotData folder (HOME/DreamBot/BotData).

    Then, you'll need to create a class list, meaning you will need to run this command:

    java -Xshare:off -XX:DumpLoadedClassList=dreambot.classlist -jar client.jar

    This will launch the client like normal, and to maximize your RAM savings, you should login, use the client like you normally would, and run any scripts you'd like to use (run a few cycles to make sure every class is loaded).

    After that, close the client and go back to the same terminal that just ran that command and run this:

    java -Xshare:dump -XX:SharedArchiveFile=dreambot.jsa -XX:SharedClassListFile=dreambot.classlist -jar client.jar

    Use the Shared Archive to Save RAM

    Now that you have the archive built, that's pretty much it. Now when you launch the client via CLI, add the flag shown below:

    java -XX:SharedArchiveFile=dreambot.jsa -jar client.jar

    You can still use QuickStart and any other flags you'd like in addition, just make sure the SharedArchiveFile flag is also present.

     

    Hope that's helpful!

    Link to comment
    Share on other sites

    im getting this after entering the 2nd command line

    Error: VM option 'SharedArchiveFile' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions.
    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit.


    @Pandemic

    Link to comment
    Share on other sites

    19 hours ago, calipso1999 said:

    im getting this after entering the 2nd command line

    Error: VM option 'SharedArchiveFile' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions.
    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit.


    @Pandemic

    I believe it's standard on the newer JDK versions, but for whatever version you're on, it looks like you can just add that flag they suggest and it might still work. So the command would look like:

    java -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=dreambot.jsa -jar client.jar

     

    Link to comment
    Share on other sites

    • 7 months later...
    On 2/20/2021 at 5:00 PM, Pandemic said:

    I believe it's standard on the newer JDK versions, but for whatever version you're on, it looks like you can just add that flag they suggest and it might still work. So the command would look like:

    java -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=dreambot.jsa -jar client.jar

     

    This worked great!

    However I have a question regarding proxies, do we need to load the client normally and input proxies and then load these instances this way?

    Or does this method of using the bot not allow proxies?

    TIA, just trying to be safe I'm new.

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.