Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Improve performance when saving to database (Read 3644 times)
Espen Lodden
Guest


Improve performance when saving to database
Nov 7th, 2005 at 12:25pm
Print Post  
Hello,

we are evaluating the FlowChart .NET and have trouble when saving to an Oracle database stream.  Loading from the stream works fine, and does not take long time (although it's not fast). Saving however, takes ages. Saving a diagram with two nodes took more than one minute. Is there anything we could do to improve this?

Excerpt from our code follows:

OracleCommand cmd = new OracleCommand("", conn);
OracleDataReader reader;
OracleLob lob;
OracleTransaction txn = conn.BeginTransaction();
cmd.CommandText = "SELECT schema FROM test WHERE id = 1 FOR UPDATE";
cmd.Transaction = txn;
reader = cmd.ExecuteReader();
reader.Read();
lob = reader.GetOracleLob(0);

//This function is VERY slow
_flowChart.SaveToStream(lob);

txn.Commit();
dl.disconnect(conn);

Best Regards
Espen Lodden

www.emisoft.com
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Improve performance when saving to database
Reply #1 - Nov 7th, 2005 at 12:51pm
Print Post  
Hello,

Thank you for trying FlowChart.NET.

Saving speed has been greatly improved in the version 4 of the control, which is now in beta tests:

https://mindfusion.org/_beta/FCNetDemo.zip

Although if two nodes are saved for a whole minute, that might mean that the OracleLob Stream implementation is slow. Try calling the flowchart's SaveToString method to measure how much time is needed to save the diagram in a memory buffer,  and then write the returned string to a Text/Memo field.

Or check whether the Oracle stream has some option to preallocate space for the diagram instead of growing the field dynamically several times. I guess writing to the OracleLob can be very slow also if the Oracle stream uses network communications to access the database without buffering. FlowChart.NET will write many small chunks of data to the stream, so calling SaveToString and then sending the whole string to the Oracle server could be the best solution.

Best Regards
Stoyan
  
Back to top
 
IP Logged
 
Espen Lodden
Guest


Re: Improve performance when saving to database
Reply #2 - Nov 7th, 2005 at 1:05pm
Print Post  
Thank you very much for the quick reply. We will try your suggestions.

Best Regards
Espen Lodden
  
Back to top
 
IP Logged
 
Espen Lodden
Guest


Re: Improve performance when saving to database
Reply #3 - Nov 7th, 2005 at 1:28pm
Print Post  
Thanks a lot,
saving to a string and using byte array to the database worked like a charm. Less than a second.

This is very promising!

Espen Lodden
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Improve performance when saving to database
Reply #4 - Nov 7th, 2005 at 1:38pm
Print Post  
That's great!

But then SaveToString uses 4 times more space than a byte stream would need, because every byte is represented with 2 Unicode characters in the string. So in order to save some space, it will be even better to create a .NET MemoryStream, pass it to the SaveToStream method, and pass the memoryStream's bytes to the Oracle stream.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint