System Lag DThinkScriptCalculatingPool

Glefdar

Active member
Has anyone ever checked if vmoptions parameter “DThinkScriptCalculatingPool” evenly distributes load across multiple TOS instances?

The vmoptions file for the TOS executable can have a parameter added “-DThinkScriptCalculatingPool=16” where 16 is the number of cores your CPU has.

I’ve read that this parameter allows the application to run more efficiently.
However, it’s unclear if the value needs to be divided for the number of TOS installations that are running simultaneously.

If I have 8 TOS installations running, should this value be set to 2 in each vmoptions file or should it be kept at 16 because the application is going to evenly distribute the load?

I asked this question in one of the ThinkOrSwim support chat rooms and didn’t receive any clarity. So I’m wondering if anyone has benchmarked this before.
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Has anyone ever checked if vmoptions parameter “DThinkScriptCalculatingPool” evenly distributes load across multiple TOS instances?

The vmoptions file for the TOS executable can have a parameter added “-DThinkScriptCalculatingPool=16” where 16 is the number of cores your CPU has.

I’ve read that this parameter allows the application to run more efficiently.
However, it’s unclear if the value needs to be divided for the number of TOS installations that are running simultaneously.

If I have 8 TOS installations running, should this value be set to 2 in each vmoptions file or should it be kept at 16 because the application is going to evenly distribute the load?

I asked this question in one of the ThinkOrSwim support chat rooms and didn’t receive any clarity. So I’m wondering if anyone has benchmarked this before.
https://usethinkscript.com/threads/thinkorswim-app-system-lag.1173/#post-50764
 
Has anyone ever checked if vmoptions parameter “DThinkScriptCalculatingPool” evenly distributes load across multiple TOS instances?

The vmoptions file for the TOS executable can have a parameter added “-DThinkScriptCalculatingPool=16” where 16 is the number of cores your CPU has.

I’ve read that this parameter allows the application to run more efficiently.
However, it’s unclear if the value needs to be divided for the number of TOS installations that are running simultaneously.

If I have 8 TOS installations running, should this value be set to 2 in each vmoptions file or should it be kept at 16 because the application is going to evenly distribute the load?

I asked this question in one of the ThinkOrSwim support chat rooms and didn’t receive any clarity. So I’m wondering if anyone has benchmarked this before.

This setting is in the vmoptions file, which each instance uses when it starts up. So therefore, if you run concurrent instances, you should specify your total virtual cores / instances. For example:

Total virtual cores: 16 (ex. 8 cores w/ hyperthreading)
Concurrent instances: 8
DThinkScriptCalculatingPool: 2 (16 / 8)

I'm running two ToS instances on my 20c/40vc Linux workstation and will be testing the impact of setting DThinkScriptCalculatingPool to 20, before I test running more concurrent instances. I'll report my findings.
 
This setting is in the vmoptions file, which each instance uses when it starts up. So therefore, if you run concurrent instances, you should specify your total virtual cores / instances. For example:

Total virtual cores: 16 (ex. 8 cores w/ hyperthreading)
Concurrent instances: 8
DThinkScriptCalculatingPool: 2 (16 / 8)

I'm running two ToS instances on my 20c/40vc Linux workstation and will be testing the impact of setting DThinkScriptCalculatingPool to 20, before I test running more concurrent instances. I'll report my findings.
It would be great if you’re able to determine more details about how this parameter should be used. Please keep us updated!
 
Yes, as of this evening, I have conclusions that might help others...

Let me start with contextualizing my findings with more specifics about my trading workstation. At the end of this post, I will provide conclusions that should benefit anyone with lesser or greater specs.

MODEL: HP Z620
CPU: 2 x Xeon E5-2680 v2 @ 2.80GHz (total of 20 cores / 40 threads)
RAM: 192GB DDR3
DISK: PNY CS900 1TB SSD
VIDEO: Radeon R9 Nano 4GB
SCREENS: Four physical * x virtual desktops
OS: Debian 12
JVM: Originally Zulu but currently using Corretto-17.0.11.9.1.

Next, I should probably provide a high level overview of my ToS views.

Virtual desktop #1, bottom two physical screens:
  • Used for analyzing whatever stock is in #1
  • Seven columns spread across both screens
  • 3YM, 3YW, 1YD, 1D30m, 1D5m, 1D1m, buttons+T&S+L2
  • Each chart column has about six technical indicator rows

Virtual desktop #1, top two physical screens:
  • Used for monitoring four more stocks
  • Two columns per stock--1D5m and 1D1m--for a total of eight columns
  • Stocks in #2, #3, #4, and #5
  • Each chart column has about six technical indicator rows

Virtual desktop #2, all four physical screens:
  • Used to enter/exit same four stocks
  • Four columns per stock--1D30m, 1D5m, 1D1m, and buttons+T&S+L2--for a total of 16 columns
  • Stocks in #2, #3, #4, and #5
  • Each chart column has about six technical indicator rows

Now, at the time of my last post, I had the following settings configured in thinkorswim.vmoptions:
-Xmx32768m
-Xms16384m
-DThinkScriptCalculatingPool=20

Unfortunately, I still experienced two symptoms:
1. Lagging (bad but able to endure it)
2. Crashing (very often, like 1-3 times a day, usually when interacting with the menus)

The crashing was actually so bad that I moved my use of Stock Hacker to a second computer with an entirely separate ToS instance. And even then, I used Visual Studio Code to create my scripts because it was "safer" to copy & paste rather than actually make changes within the Thinkscript "IDE". The crashing in the IDE and the crashing in the menu was just miserable.

All during this time, my computer was mostly idling. CPU and RAM was in use but not even close to 20%.

I switched between the Zulu and Corretto JVMs which didn't seem to make much of a difference. I lowered DThinkScriptCalculatingPool which didn't resolve the lagging or crashing either. So then I focused on memory, increasing the Xmx and Xms settings until I hit the max that the JVM (or perhaps ToS) would allow--Xmx65408m and Xms32768m. It just didn't seem to help.

Today I had an idea--since ToS runs out of the local folder, what if I just created multiple copies of the folder so I could run separate instances for my "views" listed above?

I set about doing this. I made four copies of my thinkorswim folder, each with a suffix that describes the purpose/view. My thinkorswim.vmoptions file in each is configured thus:
-Xmx8192m
-Xms4096m
-DThinkScriptCalculatingPool=5

I started a ToS instance from each folder and configured the following:

Instance #1, virtual desktop #1, bottom two physical screens:
  • Used for analyzing whatever stock is in #1
  • Seven columns spread across both screens
  • 3YM, 3YW, 1YD, 1D30m, 1D5m, 1D1m, buttons+T&S+L2
  • Each chart column has about six technical indicator rows

Instance #2, virtual desktop #2, ALL four physical screens:
  • Used for monitoring EIGHT (up from only four previously) more stocks
  • Two columns per stock--1D5m and 1D1m--for a total of 16 columns
  • Stocks in #2, #3, #4, and #5
  • Each chart column has about six technical indicator rows

Instance #3, virtual desktop #3, all four physical screens:
  • Used to enter/exit four stocks
  • Four columns per stock--1D30m, 1D5m, 1D1m, and buttons+T&S+L2--for a total of 16 columns
  • Stocks in #2, #3, #4, and #5
  • Each chart column has about six technical indicator rows

Instance #4, virtual desktop #4, all four physical screens:
  • Used to enter/exit four stocks
  • Four columns per stock--1D30m, 1D5m, 1D1m, and buttons+T&S+L2--for a total of 16 columns
  • Stocks in #6, #7, #8, and #9
  • Each chart column has about six technical indicator rows

Now, I made these changes this evening, i.e. after hours, so the verdict is not out yet. But already I can tell each instance runs a LOT smoother. The cross hair, which is sync'd across charts, is snappier than I have seen it in a long time. I have had zero lagging and crashing. Tomorrow will be the true performance test. I'll let you know how it goes.

Thus far, however, it seems that switching from a setup that runs everything under one instance to a setup that spreads everything over four instances is going to be a lot more efficient. I think this same concept might work for Windows and Linux users with other amounts of CPU and memory resources, i.e. calculate your DThinkScriptCalculatingPool value but then divide it by the number of ToS instances you plan to run. Also do the same with the Xmx and Xms values.
 
For anyone who was/is interested in reading this thread... You can probably tell I am a performance junkie. I absolutely detest software or hardware that can't keep up with me! (But I also love a bargain, which is why I only use refurbished business/enterprise hardware!) Well, running ToS on Linux has been a trip, to say the least. I'm going to provide my top x recommendations below after months (a year now?) of using ToS on Linux.

Recommendation #1: -Dsun.java2d.opengl=true

This switch, added to your thinkorswim.vmoptions file, will force the 2D rendering to take place on the GPU (using the Mesa OpenGL driver). This will increase the speed of rendering by a HUGE factor. I mean, it's night and day stuff. I have an old Radeon 6600XT but the performance is out of this world. I installed the necessary dependencies to see my GPU consumption in btop and proved the rendering is taking place on the GPU. I can move my cursor rapidly around all the charts and see the GPU spike upwards to 40%. (Without the switch above, the CPUs spike instead.) HOWEVER, before you just add this to your file, carefully consider the following caveats:
  • I have only tested this with a Radeon card. I have no idea if this will work with an Intel or NVIDIA card.
  • I have only tested this on KDE Plasma with the KWin window manager.
  • The switch works on X11 BUT (BIGGIE) only if you run a single java instance of the ToS. If you attempt to run a 2nd instance, it will fail and you'll see video artifacts.
  • However, the switch also works on Wayland which has better GPU pipeline rendering (?) which lets multiple java instances of ToS share the GPU without issue. I was finally able to move to Wayland, and this was the main motivation that got me there (and over my dependency on X11-only apps).
Here is a screenshot of the GPU flexing when I move the mouse cursor rapidly through all the charts on my screen:
2025-08-26_182158.png


Recommendation #2: If you use a lot of charts (and possibly a lot of indicators), split them into multiple java instances.

This takes time and patience, but basically you just clone your original ToS folder. Then you open each one, removing the charts that are in the other instances. Here's my setup as an example:

Linux
-- Virtual desktop 1
-- -- Instance 1: Vertical stack of M / W / D charts (left 50% of my screen)
-- -- Instance 2: Vertical stack of 2h / 15m / 5m charts (right 50% of my screen)
-- Virtual desktop 2
-- -- Instance 1: Two vertical stacks of 2h / 15m / 5m charts (for stocks 2-3) (left 50% of my screen)
-- -- Instance 2: Two vertical stacks of 2h / 15m / 5m charts (for stocks 4-5) (left 50% of my screen)
-- Virtual desktop 3
-- -- Instance 1: Two vertical stacks of 2h / 15m / 5m charts (for stocks 6-7) (left 50% of my screen)
-- -- Instance 2: Two vertical stacks of 2h / 15m / 5m charts (for stocks 8-9) (left 50% of my screen)

You can see above that I split one big java instance into six small java instances. I'm still using the same amount of charts, but I found that either java or ToS don't handle threading that well. By running separate instances, I experience much better performance.

Recommendation #3: -Xms32m and -Xmx1536m

As you know, these are the java instance heap memory sizes. I used VisualVM to analyze the java instances and found that they really don't use or need that much. So I configure all mine to start with the minimum (-Xms32m) and then whatever I feel is reasonable for their maximum. In my previous example setup, the instances under virtual desktop 1 only use about 500MB of heap. So setting the upper limit to the minimum that ToS will permit (or maybe it's a java minimum) of 1536m makes the most sense.

Of course, you should obviously tally up your maximums across all instances to make sure you don't blow up your RAM and bring your system to a halt.

Recommendation #4: -DThinkScriptCalculatingPool=5

This isn't really a recommendation. Technically, you're supposed to calculate your total virtual cores (i.e. cores w/ hyperthreading) divided by the number of instances of ToS you plan to run. For example, I have 20 cores with hyperthreading, and I run at least six instances. So my calculation would be (20 x 2) / 6 = 6 for -DThinkScriptCalculatingPool, but at some point I settled on 5. It works well for me. But now that I am forcing java to pass the 2D rendering to the GPU, I don't even know if this matters that much.

Recommendation #5: Use Amazon's Corretto JDK instead of Zulu

I know Schwab recommends the latter, but I noticed a distinct performance drop over using Corretto. You can read more about this JDK at https://aws.amazon.com/corretto/faqs/.

I hope this helps! Hit me up if you have any questions!
 
Last edited:
Wow. Who would have thought the kernel my workstation was using had an AMD GPU problem causing my GPU to fall back on software rendering? I had no idea this would be the discovery when I enlisted AI to help me find performance tweaks this morning. No wonder ToS has been so sluggish of late! Thankfully, it was an easy fix--enable backports and install the latest kernel. Now ToS is performing smoothly again!
 
I like what you did but I have no idea how to do all that;( I know how to drive TOS or a computer not how to fix or reorganize it like you did. Maaaaybee you could make a Video how, for us like me ??? Please.
 
Thread starter Similar threads Forum Replies Date
B ThinkorSwim App System Lag Playground 56
dap711 Nexus II - A Python coded AI that advises and a system that decides. Playground 28

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
1281 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top