How to take full advantage of processor, memory and ssd?
How to take full advantage of processor, memory and ssd?
23 Oct 2014, 22:46
Hi,
I have got core i7 2600k 3.50ghz procressor and ssd drive on my pc. My backtests take about 2 days to complete. During the backtest calgo is usually using 10-15% of my processor and same as do the ssd. How can my robot be optimized to take full advantage of my processor? FYI my robot uses mysql to read and write trade info on every tick.
Replies
alifarooq
24 Oct 2014, 12:02
Thanks i'll try that as i establish connection on every query.
@alifarooq
alifarooq
24 Oct 2014, 12:09
RE:
When i execute the code this happens.
27/01/2014 00:20:02.471 | Crashed in OnTick with MySqlException: There is already an open DataReader associated with this Connection which must be closed first.
Spotware said:
Probably database is the bottleneck. You can try the following things:
- Do not establish database connection on every query. Instead of that you can establish database connection in OnStart method and drop it in OnStop method
- Install database on your machine, instead of connecting to remote one
- Try other database engines. There is a chance that this problem is specific for mysql.
@alifarooq
Invalid
24 Oct 2014, 12:22
RE: RE:
Dispose DataReader when you exit from OnTick. Example:
using(MySqlDataReader Reader = cmd.ExecuteReader()) { // your cool stuff here }
alifarooq said:
When i execute the code this happens.
27/01/2014 00:20:02.471 | Crashed in OnTick with MySqlException: There is already an open DataReader associated with this Connection which must be closed first.
Spotware said:
Probably database is the bottleneck. You can try the following things:
- Do not establish database connection on every query. Instead of that you can establish database connection in OnStart method and drop it in OnStop method
- Install database on your machine, instead of connecting to remote one
- Try other database engines. There is a chance that this problem is specific for mysql.
@Invalid
alifarooq
24 Oct 2014, 12:28
RE: RE: RE:
OpenConnection(); string stm = "SELECT pid,hedge_level,current_upper_point,current_lower_point FROM " + logtable + " WHERE pid='" + position1.Label + "'"; MySqlCommand cmd1 = new MySqlCommand(stm, connection); rdr = cmd1.ExecuteReader(); if (rdr.HasRows) { while (rdr.Read()) { //currentHedgeLevel = rdr.GetInt32(1); currentupperpoint = Math.Round(rdr.GetDouble(2), 5); currentlowerpoint = Math.Round(rdr.GetDouble(3), 5); } } CloseConnection();
can you tell how can i dispose this reader?
Invalid said:
Dispose DataReader when you exit from OnTick. Example:
using(MySqlDataReader Reader = cmd.ExecuteReader()) { // your cool stuff here }
alifarooq said:
When i execute the code this happens.
27/01/2014 00:20:02.471 | Crashed in OnTick with MySqlException: There is already an open DataReader associated with this Connection which must be closed first.
Spotware said:
Probably database is the bottleneck. You can try the following things:
- Do not establish database connection on every query. Instead of that you can establish database connection in OnStart method and drop it in OnStop method
- Install database on your machine, instead of connecting to remote one
- Try other database engines. There is a chance that this problem is specific for mysql.
@alifarooq
Invalid
24 Oct 2014, 12:38
RE: RE: RE: RE:
//OpenConnection(); - this should be done in OnStart string stm = "SELECT pid,hedge_level,current_upper_point,current_lower_point FROM " + logtable + " WHERE pid='" + position1.Label + "'"; using(MySqlCommand cmd1 = new MySqlCommand(stm, connection)) { using(var rdr = cmd1.ExecuteReader()) { if (rdr.HasRows) { while (rdr.Read()) { //currentHedgeLevel = rdr.GetInt32(1); currentupperpoint = Math.Round(rdr.GetDouble(2), 5); currentlowerpoint = Math.Round(rdr.GetDouble(3), 5); } } } } // CloseConnection(); - execute it in OnStop
alifarooq said:
OpenConnection(); string stm = "SELECT pid,hedge_level,current_upper_point,current_lower_point FROM " + logtable + " WHERE pid='" + position1.Label + "'"; MySqlCommand cmd1 = new MySqlCommand(stm, connection); rdr = cmd1.ExecuteReader(); if (rdr.HasRows) { while (rdr.Read()) { //currentHedgeLevel = rdr.GetInt32(1); currentupperpoint = Math.Round(rdr.GetDouble(2), 5); currentlowerpoint = Math.Round(rdr.GetDouble(3), 5); } } CloseConnection();can you tell how can i dispose this reader?
Invalid said:
Dispose DataReader when you exit from OnTick. Example:
using(MySqlDataReader Reader = cmd.ExecuteReader()) { // your cool stuff here }
alifarooq said:
When i execute the code this happens.
27/01/2014 00:20:02.471 | Crashed in OnTick with MySqlException: There is already an open DataReader associated with this Connection which must be closed first.
Spotware said:
Probably database is the bottleneck. You can try the following things:
- Do not establish database connection on every query. Instead of that you can establish database connection in OnStart method and drop it in OnStop method
- Install database on your machine, instead of connecting to remote one
- Try other database engines. There is a chance that this problem is specific for mysql.
@Invalid
alifarooq
24 Oct 2014, 12:43
RE: RE: RE: RE: RE:
thanks
Invalid said:
//OpenConnection(); - this should be done in OnStart string stm = "SELECT pid,hedge_level,current_upper_point,current_lower_point FROM " + logtable + " WHERE pid='" + position1.Label + "'"; using(MySqlCommand cmd1 = new MySqlCommand(stm, connection)) { using(var rdr = cmd1.ExecuteReader()) { if (rdr.HasRows) { while (rdr.Read()) { //currentHedgeLevel = rdr.GetInt32(1); currentupperpoint = Math.Round(rdr.GetDouble(2), 5); currentlowerpoint = Math.Round(rdr.GetDouble(3), 5); } } } } // CloseConnection(); - execute it in OnStop
alifarooq said:
OpenConnection(); string stm = "SELECT pid,hedge_level,current_upper_point,current_lower_point FROM " + logtable + " WHERE pid='" + position1.Label + "'"; MySqlCommand cmd1 = new MySqlCommand(stm, connection); rdr = cmd1.ExecuteReader(); if (rdr.HasRows) { while (rdr.Read()) { //currentHedgeLevel = rdr.GetInt32(1); currentupperpoint = Math.Round(rdr.GetDouble(2), 5); currentlowerpoint = Math.Round(rdr.GetDouble(3), 5); } } CloseConnection();can you tell how can i dispose this reader?
Invalid said:
Dispose DataReader when you exit from OnTick. Example:
using(MySqlDataReader Reader = cmd.ExecuteReader()) { // your cool stuff here }
alifarooq said:
When i execute the code this happens.
27/01/2014 00:20:02.471 | Crashed in OnTick with MySqlException: There is already an open DataReader associated with this Connection which must be closed first.
Spotware said:
Probably database is the bottleneck. You can try the following things:
- Do not establish database connection on every query. Instead of that you can establish database connection in OnStart method and drop it in OnStop method
- Install database on your machine, instead of connecting to remote one
- Try other database engines. There is a chance that this problem is specific for mysql.
@alifarooq
Spotware
24 Oct 2014, 09:27
Probably database is the bottleneck. You can try the following things:
@Spotware