- 2023.09.19
- www.mql5.com
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Hello Forum Members,
I'm currently facing a perplexing issue and I'm in search of both answers and potential solutions. I have the MetaTrader 4 application running on my Windows machine, which is equipped with a 4-core CPU. This setup includes a custom expert advisor that operates on all charts (currently 22) simultaneously. On my Windows machine, the CPU utilization never exceeds 20%.
However, when I try to run the same setup on the latest Wine environment, something strange occurs. Wine generates 23-24 tasks to process all the charts, causing the CPU to run at full capacity, with a load average of 22-23. It's important to note that MetaTrader 4 doesn't hang in this scenario, but the high CPU load is a noticeable contrast to the Windows experience.
While I comprehend that the expert advisor is concurrently managing all the charts, I'm determined to find a plausible explanation or solution for Wine's behaviour in creating so many tasks. Any assistance or insights you can provide would be immensely appreciated.
Thank you in advance for your support!
Apples and oranges... UNIX-based operating systems (MacOS, Linux, BSD, etc.) can report on CPU load which is merely the length of the wait-queue of tasks waiting to get some time on the CPU. This can not be compared to the CPU utilization as reported by Windows. If all tasks request to be serviced at the same time but complete their work in a millisecond, you can have a load of 100 with a utilization of only 1%
For Linux webservers that run thousands of tasks in parallel the rule of thumb is that the CPU load should not exceed the amount of cores in the system (usually 48 or higher for professional servers) to have a quick response / low latency. On your 4-core CPU all tasks can run at full speed if the load does not exceed 4. If the load is higher, like you indicate, that means some tasks need to wait a few milliseconds before being serviced by the CPU. As long as your system still feels responsive, this is not a problem.
In my experience, experts/indicators that use OnTimer() in MT5 can cause this in Linux (probably because the tasks all want to be serviced at the same time like the example I gave above). This is not a problem because the timer events will not "stack up". If there is still an unprocessed timer event in the queue, the system will not queue additional timer events.
Hello Forum Members,
I'm currently facing a perplexing issue and I'm in search of both answers and potential solutions. I have the MetaTrader 4 application running on my Windows machine, which is equipped with a 4-core CPU. This setup includes a custom expert advisor that operates on all charts (currently 22) simultaneously. On my Windows machine, the CPU utilization never exceeds 20%.
However, when I try to run the same setup on the latest Wine environment, something strange occurs. Wine generates 23-24 tasks to process all the charts, causing the CPU to run at full capacity, with a load average of 22-23. It's important to note that MetaTrader 4 doesn't hang in this scenario, but the high CPU load is a noticeable contrast to the Windows experience.
While I comprehend that the expert advisor is concurrently managing all the charts, I'm determined to find a plausible explanation or solution for Wine's behaviour in creating so many tasks. Any assistance or insights you can provide would be immensely appreciated.
Thank you in advance for your support!
MT4 is single-threaded so one instance can run only on one core. What I would do is split the installation into 2 - i.e. clone the MT4 install and run 11 EA on each instance and see if it helps. I can't guarantee a result, but it's a simple experiment worth trying imo.
MT4 is single-threaded so one instance can run only on one core. What I would do is split the installation into 2 - i.e. clone the MT4 install and run 11 EA on each instance and see if it helps. I can't guarantee a result, but it's a simple experiment worth trying imo.
Hi Marcin,
Thanks for your response. Splitting the EA to run into 2 instances yield the same result. The load average end up to be exactly the same as running all 22 at once.
Apples and oranges... UNIX-based operating systems (MacOS, Linux, BSD, etc.) can report on CPU load which is merely the length of the wait-queue of tasks waiting to get some time on the CPU. This can not be compared to the CPU utilization as reported by Windows. If all tasks request to be serviced at the same time but complete their work in a millisecond, you can have a load of 100 with a utilization of only 1%
For Linux webservers that run thousands of tasks in parallel the rule of thumb is that the CPU load should not exceed the amount of cores in the system (usually 48 or higher for professional servers) to have a quick response / low latency. On your 4-core CPU all tasks can run at full speed if the load does not exceed 4. If the load is higher, like you indicate, that means some tasks need to wait a few milliseconds before being serviced by the CPU. As long as your system still feels responsive, this is not a problem.
In my experience, experts/indicators that use OnTimer() in MT5 can cause this in Linux (probably because the tasks all want to be serviced at the same time like the example I gave above). This is not a problem because the timer events will not "stack up". If there is still an unprocessed timer event in the queue, the system will not queue additional timer events.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm currently facing a perplexing issue and I'm in search of both answers and potential solutions. I have the MetaTrader 4 application running on my Windows machine, which is equipped with a 4-core CPU. This setup includes a custom expert advisor that operates on all charts (currently 22) simultaneously. On my Windows machine, the CPU utilization never exceeds 20%.
However, when I try to run the same setup on the latest Wine environment, something strange occurs. Wine generates 23-24 tasks to process all the charts, causing the CPU to run at full capacity, with a load average of 22-23. It's important to note that MetaTrader 4 doesn't hang in this scenario, but the high CPU load is a noticeable contrast to the Windows experience.
While I comprehend that the expert advisor is concurrently managing all the charts, I'm determined to find a plausible explanation or solution for Wine's behaviour in creating so many tasks. Any assistance or insights you can provide would be immensely appreciated.
Thank you in advance for your support!