Dukascopy
 
 
Wiki JStore Search Login

Request for advice re profiling strategy in client
 Post subject: Request for advice re profiling strategy in client Post rating: 0   New post Posted: Thu 07 Jun, 2012, 22:39 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
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.


 
 Post subject: Re: Request for advice re profiling strategy in client Post rating: 0   New post Posted: Mon 18 Jun, 2012, 11:33 
JForex Master
User avatar

User rating:
Joined: Wed 16 Sep, 2009, 18:23
Posts: 1045
Location: Geneva, Switzerland
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" />


 
 Post subject: Re: Request for advice re profiling strategy in client Post rating: 0   New post Posted: Wed 20 Jun, 2012, 11:00 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
Thanks.


 
 Post subject: Re: Request for advice re profiling strategy in client Post rating: 0   New post Posted: Wed 26 Sep, 2012, 18:58 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
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?


 
 Post subject: Re: Request for advice re profiling strategy in client Post rating: 0   New post Posted: Fri 28 Sep, 2012, 12:12 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
Here is a (slightly clumsy) solution:
https://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=81&t=48106


 

Jump to:  

cron
  © 1998-2024 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com