
d_allen
-Interested User-
Posts: 29
Joined: Nov 5, 2008
|
Posted: Nov 26, 2008 12:51 PM

Msg. 1 of 3
hello my fellow iqFeeders, i'm a newbie/novice and i was wondering if someone could me give advice on optimizing the IQFeed? i'm currently watching over 500 equity options and simultaneously parsing and saving (sql insert) the messages to a MySQL data base. i'm using the IQFeed activeX control to receive message and the language i'm using is vb.net. if anyone has any solutions, advice, recommendations, etc please share them with me...
thanks Edited by d_allen on Feb 21, 2010 at 05:05 PM
|

jimc
-Interested User-
Posts: 35
Joined: Jan 22, 2008
|
Posted: Nov 26, 2008 02:41 PM

Msg. 2 of 3
Donald, I have a couple suggestions for you. First, I used the ActiveX feed with a .NET-based program (C#) for many months. The ActiveX overhead was too much for my computer (a reasonably fast dual CPU machine); when volume spiked, my program fell progressively further behind receiving and processing the feed. I'm only watching about 65 symbols, too. I recently switched to the socket interface, and it's much, much faster for me. (I think this big performance difference might not necessarily be there if one was writing a non-.NET program.) So rather than beat your head against the wall trying to get your ActiveX-based code running as fast as possible, you may want to switch to the socket interface. It's probably the biggest single thing you can do to speed things up.
Also, the socket interface lets you specify which fields you want to receive, and that can drastically reduce the amount of bandwidth and parsing it takes to receive the feed. The ActiveX interface doesn't support this feature yet.
Second, if your database can't keep up with so many inserts, you could: 1). Let the data build up for awhile (e.g., at least a few seconds), then have a separate thread go do an insert 2). Spend some time optimizing your database configuration for your needs; I use Oracle, so I don't know much about mySQL, but I'm sure there are plenty of things you can do to optimize it for an insert-heavy load like yours. 3). Run your database on a separate computer on your network 4). Instead, write the data to a file, and write a small program to run at the end of the day to insert it all into your database 5). Write the data to a file and read it back from a file, rather than into/out of a database
Third, when optimizing a program, usually a little bit of work goes a long way at first. In other words, look first for places where you're storing a value that's actually unchanged, or recalculating an indicator when the underlying data hasn't changed yet.
Fourth, once you've gotten the low-hanging fruit in terms of optimization, you may find it useful to use a third-party optimization tool. I use and like the Ants Profiler, but I'm sure there are many others.
One other thing: compile your program with using the "Release" configuration instead of the "Debug" configuration, if that's an option in VB. It makes a big difference in C#.
Good luck.
Jim
|

jimc
-Interested User-
Posts: 35
Joined: Jan 22, 2008
|
Posted: Dec 1, 2008 11:31 AM

Msg. 3 of 3
One other thing: allocating memory is usually a relatively expensive operation. So look for places where you're allocating memory many times (e.g., string creation) and change them to avoid so many allocations (e.g., use the StringBuilder class).
Jim
|