Dukascopy Support Board

Request for advice re profiling strategy in client
Page 1 of 1

Author:  Isak [ Thu 07 Jun, 2012, 22:39 ]
Post subject:  Request for advice re profiling strategy in client

I sometimes run strategies in the JF client, that have a "heavy footprint" in the sense that they internally simulate about 50 sub-strategies (in one IStrategy), placing and modifying and deleting hundreds of orders every day.

When I run this in backtest mode, all usually goes well, except...
If I run more than about 20 sub-strategies over several years, then at some point (after about 2 years) the backtesting suddenly slows down (by a factor of perhaps 10).

I tried periodic calls to System.gc() but they change nothing. Perhaps there are some collections that just grow too big, but I don't know how to find them in my code.

The html report that the client generates (if enabled) after backtests, contains some rudimentary profiling information about how much time various system (backtester) tasks and various IStrategy method calls consumed (e.g. "onTick method calls 32m 32s 32.32ms"). So I thought I might be able to see here whether the slow-down is due to the backtester or due to my strategy. However, this report is apparently not generated at all under these conditions, supposedly because it is too big (with hundreds of thousands of orders).

However, assuming that the slow-down is due to my strategy and not the JF framework, can you help me by recommending a way to profile my strategy at a deeper level than the IStrategy interface? I work in Netbeans, and noticed that it has a built-in profiler, but this is not a standalone application so I'm not sure whether there is a way to attach it to my strategy, or to the JF client as a whole perhaps? I'm rather unfamiliar with profilers and the JVM in general.

Any advice or pointers would be appreciated.

EDIT: It is indeed a memory problem. I get "Strategy tester: java.lang.OutOfMemoryError: Java heap space" eventually. I'll be going through my code to try find any collections that grow extremely big, but it would be nice to know for sure whether it is on my side of the API or on the backtester's side, if there is some way of determining that.

Author:  Platform Support [ Mon 18 Jun, 2012, 11:33 ]
Post subject:  Re: Request for advice re profiling strategy in client

You can try to increase the min and max heap size in the jnlp file before the platform launch.

The default settings are:
<java version="1.6+" initial-heap-size="32m" max-heap-size="512m" />

try to increase them, for example:
<java version="1.6+" initial-heap-size="512m" max-heap-size="1024m" />

Author:  Isak [ Wed 20 Jun, 2012, 11:00 ]
Post subject:  Re: Request for advice re profiling strategy in client


Author:  Isak [ Wed 26 Sep, 2012, 18:58 ]
Post subject:  Re: Request for advice re profiling strategy in client

But is the jnlp file liable to change over time? Would that mean I have to monitor it for changes and download a local copy and edit each time it changes? Or is there another way?

Author:  Isak [ Fri 28 Sep, 2012, 12:12 ]
Post subject:  Re: Request for advice re profiling strategy in client

Here is a (slightly clumsy) solution:

  Page 1 of 1