Link to home
Start Free TrialLog in
Avatar of danz67
danz67Flag for Italy

asked on

Delphi 7 - Slow Application

Hi,
I created application (APP1) that uses a MySql database. Many customers have said that the program works very well and is very fast after a bit of time leave standby APP1 and do other things. When returning to use APP1 notice very slow in the insertion of data and go in Task Manager APP1 uses 80 % of the CPU.
Greetings.
Avatar of BdLm
BdLm
Flag of Germany image

you can try to download a profile for delphi and check to slow lines of code
Avatar of danz67

ASKER

Ok i try it, but the problem is when APP1 is in standby
Avatar of MerijnB
Do you have separate threads in your application?
Avatar of danz67

ASKER

I don't know
May be the MYSQL connection is in a separate thread, can you check the taskmanager in WIN, how many processes are created when running your app1.
> I don't know.

What do you use to connect to the MySQL server?

Avatar of danz67

ASKER

MerijnB:
> What do you use to connect to the MySQL server?

CoreLab
Avatar of danz67

ASKER

BdLm:
>May be the MYSQL connection is in a separate thread, can you check the taskmanager in WIN, how many processes are created

Only one
Avatar of danz67

ASKER

Maybe the proble is here
list.bmp
some connections close the active connection after a certain time being idle (firewall can do this too)

it's possible you make a new connection after closing ...
do you use connection pooling ?
if so, does switching it off help ?

It's in the TMyDac Connection object properties
Avatar of danz67

ASKER

Pooling is false in proprieties.
ASKER CERTIFIED SOLUTION
Avatar of Geert G
Geert G
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of danz67

ASKER

I tried this unit in the project and if I try to start for the second time app1 warns me that is already running. This is good, but are sure this is the problem? When app1 is running in task manager I see only one process. You say something else in your project use different DataModule and each has a connection that starts at startup app1, probably this is that create different connections to MySql.
well, there is more than 1 possibility:
a: multiple connections with 1 app
b: multiple connections with multiple apps
c: 1 connection with multiple app

i guess you don't want any of these, unless option a if you are using threads.

so ... are you using threads in your app ?
Avatar of danz67

ASKER

I use APP1 with multiple connections to the server MySql, but believe that this can slow APP1 after a bit of time?
what are you doing with the multiple connections ?
are you creating them on the fly (adding them as you need)
and not freeing them ?
Avatar of danz67

ASKER

connections are open to the start of app1 and are never closed
could try the profiler, which function is getting that slow?
Avatar of danz67

ASKER

Are unable to use it.
which profiler did you try to use?
if you do not have separate threads in your app, it's no use of having more than 1 connection.
1 connection will just wait on an other in the same thread.

so you need to know if you are creating more than 1 thread

if you don't know how, try search / find in files to look for something like this  "class(TThread)"

type
  TMyThread = class(TThread)
  ...
  protected
    procedure Execute; override;
  ...
  end;


did you create this app yourself ?
@ Geert_Gruwez:

I have a simillar problem (unsolved) using INDY Client Server  (Win2K, D7, Indy 9)
 test#i :  INDY SERVER APPLICATION using 100 % CPU  -> good
 test #i+1 : INDY SERVER APPLICATION using 30 % CPU -> I get crazy
test #i+2 : INDY SERVER APPLICATION using 80 % CPU -> waiting ....

occurence Random, no idea how to fix that issue. no time for profiling that code.
used the profiler for other issues

Avatar of danz67

ASKER

Geert_Gruwez: did you create this app yourself ?

Yes
i'm having the same problem with some of my apps for oracle
after sleep, it seems to do some stuff for 5-10 minutes and then stops

maybe some of the db processes stop and then take a while to start again