Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 668
  • Last Modified:

Delphi CGIs hanging when too many simulateous DB Connections

The system we are developing uses one database and
can be accessed using BDE from over 20 computers
 simulataneously via Websnap.Each database connection
 uses a different Session.When testing the system with
 21 connections if there is a lot of access to the DB
 all at once (or in a very short timespan) sometimes all the CGI Processes hang.


While the processes are hung trying to open the BDE Administrator produces an error 2A06.

Our customer is currently spitting fire at the
 delay in finding and fixing this problem.

Please any advice would be great , before somebody
 is coming after me with an axe (~_~;;;

Sorry but 75 is all the points I have )-:
0
brian_sweeney
Asked:
brian_sweeney
  • 5
  • 3
  • 2
  • +3
1 Solution
 
sfockCommented:
you might have a blocking or deadlocking problem at the database. Wich DB are you using?
0
 
MotazCommented:
- Did you try to convert it to ISAPI instead?
- Did you close all opened tables using try finally?
- Did you handle all exceptions?

try
  Table1.Open;
  ...
  Table1.Close; // Normal close
except
  on e: exception do
  begin
    Table1.Close; // Error occured
    Response.Content:= E.Message;
  end; // on e:..
end; // try

Motaz
0
 
brian_sweeneyAuthor Commented:
As Fujitsu is a customer I am using Fujitsu's Symfoware.
Unfortunately there is not much information about this Database on the web.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
brian_sweeneyAuthor Commented:
Thanks for your quick response.
Unfortunately We cannot change to ISAPI, and we cannot change the database.All exceptions are handled and all Database Operations are performed within try..finally clauses.Exceptions are displayed in the browser.
We also tested using an application that launched, accessed the DB and terminated numerous times at the same time as the CGIs were running. After numerous tests the Application and CGIs hung. This was after Application.Terminate was called and the main window closed. Using a log file to debug the application we saw that the DB was successfully closed, the Application Window was destroyed, there was no exception message or any form of sytem dialog box but the the Application Process did not terminate(checked via the task manager). The CGIs terminated eventually after the System CGI Timeout but even then the Application process did not end.

Again it was impossible to open the BDE Administrator application.

The system is Windows 2000. The Delphi Version is 6.

0
 
sfockCommented:
well it looks like this would be a BDE problem the error code 2A06 maens :Engine not initialized.

let me see if i find some more informations ...
0
 
sfockCommented:
well i found this article that night be helpful :
http://bdn.borland.com/article/0,1410,27949,00.html
0
 
brian_sweeneyAuthor Commented:
Thanks but the only problems there , that could possibly pertain to my case are fixed by the Service Pack 2 which we have installed.
0
 
ziolkoCommented:
as Motaz poinetd out ISAPI would be better solution, but if You still want CGI no rpoblem, in this case it's problem of BDE switch to ADO and multiple users problem will disapear, BDE is not good while more then 16-18 users (different sessions) working at same time.
ziolko.
0
 
brian_sweeneyAuthor Commented:
Hi ziolko. Thanks for your reply. Where did you get the information about more than the 16-18 users being not good?
0
 
ziolkoCommented:
It's not from any kind of documentation but from my experience, I've created web server based on ISAPI in the begining I've used BDE, then tested it for many users executeing quite complex SQL queries and BDE caused many problems so I switched to ADO now software is used constantly by 20-25 users nad I have no problems at all.
ziolko.
0
 
CuriousDelfCommented:
ADO *IS* a much better solution... faster, smoother, more updates available for it (thus it is allso less buggy). Additionally, you have to realize that unless you are running all of your DB processes as threads, they are probably making the natural program flow wait until they are done. It's simple and stupid, but often overlooked. If you know you have done something long and tedious and about to do something else, just as bad, run Application.ProcessMessages first, so it has the time to deal with answering CGI requests and dealing with any other messages that might have popped up.

Just my 2 cents. Hope it helps.
0
 
MPountleyCommented:

Remember the BDE is not multi-treaded.

This will cause you problems.

You should not use the BDE in any Web applicattion. There are now other suitable solutions that you can use.

IB Components
and
DBISAM
are very good. DBISAM is one step up from the BDE, but the benefits are big.

Regards,
Mark
0
 
brian_sweeneyAuthor Commented:
Thanks everyone for answering.Sorry fo taking so long to answer but it took a while to test BDE and all the alternatives. It turned out ISAPI is stable but very slow.
Even when using ISAPI with BDE it wsas necessary to add a Mutex and delay to the CGIs after closing a DB connection so that the CGIs were not accessing the db at the same time.
Although it is more work to change everything now from BDE to ADO (having to retest the entire system again)it seems the best way to go.There is no need for Mutexes or delays.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 5
  • 3
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now