Disconnected mode with SSL databases

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
tiagosot
Posts: 10
Joined: Mon 01 Dec 2014 12:42

Disconnected mode with SSL databases

Post by tiagosot » Thu 18 Aug 2016 12:16

Hello,

I have an application to use massive inserts and selects on a MySQL database, because it I use DisconnectedMode once my connection is very unstable.

When using on a non-SSL connection, I can use it without problems. When database uses SSL, I have a massive use of memory, like 1 GB in 2 hours running.

What can I do to fix this situation?

Att.,
Tiago

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Disconnected mode with SSL databases

Post by ViktorV » Thu 18 Aug 2016 13:01

To investigate this behavior of MyDAC, please compose a small sample demonstrating the problem and send it to viktorv*devart*com, including database objects creating scripts.

tiagosot
Posts: 10
Joined: Mon 01 Dec 2014 12:42

Re: Disconnected mode with SSL databases

Post by tiagosot » Thu 18 Aug 2016 17:05

Victor,

Thank you. I sent and e-mail to you explaining what I have done.

Tiago

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Disconnected mode with SSL databases

Post by ViktorV » Tue 23 Aug 2016 15:01

We have answered you via e-mail.

tiagosot
Posts: 10
Joined: Mon 01 Dec 2014 12:42

Re: Disconnected mode with SSL databases

Post by tiagosot » Mon 26 Sep 2016 12:09

Hello Viktor.

I sent you an e-mail with the sources to show you my problem.

I hope we can solve this.

Best Regards,
Tiago

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Disconnected mode with SSL databases

Post by ViktorV » Wed 28 Sep 2016 13:16

The Disconnected mode allows DataSet to work without an active connection. Please note that if you explicitly opened the connection (called the TMyConnection.Connect method or set the TMyConnection.Connected property to True), the connection will remain open until you explicitly call the TMyConnection.Disconnect method or set the TMyConnection.Connected property to False. Also, until all the data satisfying the query are read, the connection will remain open. For more information about this mode, please refer to MyDAC help page: https://www.devart.com/mydac/docs/?work ... ctmode.htm
The example you sent does not demonstrate the use of Disconnected Mode: You explicitly call the TmyConnection.Connect method, the code line Sleep (16000) does not lead to the use of Disconnected mode, but leads to server disconnection upon timeout and causes Socket Error upon subsequent call to the server. You can verify this by setting the TMyConnection.Options.DisconnectedMode property to False in your example, and you will get the similar behavior.
To use the Disconnected mode in your example, you should comment out all lines calling the TMyConnection.Connect and TmyConnection.Disconnect methods, and do not use the ReconnectIfNecessary method.

tiagosot
Posts: 10
Joined: Mon 01 Dec 2014 12:42

Re: Disconnected mode with SSL databases

Post by tiagosot » Tue 04 Oct 2016 12:59

Viktor,

Thank you so much for your reply.

But I still have some doubts according memory usage.

I changed what you've said, my code does not have connect and disconnect anymore. I dropped the procedure ReconnectIfNecessary too.

When I run the application with DisconnectedMode = False, the application started using 10Mb RAM and finishes using 16Mb, but when I set DisconnectedMode = True, the same code started using 10Mb and finishes using 55Mb.

That only happens when connection uses SSL (Options.Protocol = mpSSL). When not using SSL, the applications starts with 10Mb and finishes with 13Mb (using or not DisconnectedMode).

How to deal with this memory usage? This happens in an application made to show the amount of memory, but my real application gets 1.5Gb running for 1 hour.

Best Regars,
Tiago

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Disconnected mode with SSL databases

Post by ViktorV » Tue 04 Oct 2016 14:57

To investigate the described behavior of MyDAC, please compose a small sample demonstrating it (connection to the server using SSL and without it), and send the sample to viktorv*devart*com

tiagosot
Posts: 10
Joined: Mon 01 Dec 2014 12:42

Re: Disconnected mode with SSL databases

Post by tiagosot » Tue 04 Oct 2016 15:18

Viktor,

I sent you the sample I used to show that memory usage.

Best Regards

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Disconnected mode with SSL databases

Post by ViktorV » Wed 05 Oct 2016 14:18

When creating a SSL connection, extra-resources are required, but they are allocated once. Therefore, when using SSL, there is a single memory consumption increase observed.
When investigating your sample, we detected that memory consumption increase in all modes was smaller than the one you specified. In addition, we detected a significant memory consumption increase on using SSL in Disconnected mode occurring due to that you are using OpenSSL libraries. When using SecureBridge, there is no such memory consumption increase. So, please, use SecureBridge components and make sure you are using the latest versions of our products: MyDAC 8.7.25 and SecureBridge 7.1.2.
To solve issues with memory consumption increase and application performance in Disconnected mode, you can use pooling. For this, set the TMyConnection.Pooling property to True. See more details about pooling usage in MyDAC help: https://www.devart.com/mydac/docs/Devar ... ooling.htm

tiagosot
Posts: 10
Joined: Mon 01 Dec 2014 12:42

Re: Disconnected mode with SSL databases

Post by tiagosot » Fri 04 Nov 2016 11:51

Viktor,

Thanks so much for your help!!! Using pooling with my connection helped me a lot, but still having problems with memory usage.

I'll continue seeking for a solution, but I don't know if it's possible to solve this issue.

Best regards,
Tiago

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Disconnected mode with SSL databases

Post by ViktorV » Fri 04 Nov 2016 14:12

As we wrote earlier, unfortunately, we were not able to reproduce the issue. To understand the cause of the issue and find a solution to fix it, we need a test sample, in which the issue is constantly reproduced. As soon as we receive the example, we will try to to fix it as soon as possible.

Post Reply