Board index » delphi » Threading WebBroker WebModule Apache2 Delphi7

Threading WebBroker WebModule Apache2 Delphi7


2006-11-09 09:58:04 PM
delphi2
Hello,
Newbie needs a little bit help.
I installed a Apache 2.0.59 in VMWare XP environment and now I can
compile a WebBroker WebModule Apache2 dll into the Apache/modules
folder and it looks like it is working fine.
I can call the page and it does what was planned.
http.conf file content:
LoadModule qisWebService_module modules/qisWebService.dll
<Location /qisWebService>
SetHandler qisWebService-handler
</Location>
For testing the speed and the behaviour of this new things I made a
very simple web page that saves the current time in a datetime var
waits 10 seconds and saves the time again in another variable.
At the end I put a string with both times into the response so that I
can see it in firefox.
Now my problem. If I call the same page twice in firefox (two tabs) it
looks like the second page is processed right after the first one. No
threading? What do I do wrong?
Result of first request:
StartTime: 52486.828 (seconds.milliseconds since midnight)
StopTime: 52496.828
MaxConn: 32
ActiveConn: 1
Result of second request:
StartTime: 52496.875
StopTime: 52506.890
MaxConn: 32
ActiveConn: 1
As far I could see everything is designed to do this in parallel
threads. I also could not find s.t. in the newsgroups that says that
theading in Apache or XP is not working.
 
 

Re:Threading WebBroker WebModule Apache2 Delphi7

I'm wondering if its how you're waiting 10 seconds, maybe its putting the
whole module to sleep instead of a single thread. I have never tried sleeping
a webbroker thread before so I am not sure. If its not that, do you have any
locking around your datetime var, if its global it shouldn't be.
DD
 

Re:Threading WebBroker WebModule Apache2 Delphi7

Dan Downs schrieb:
Quote
I'm wondering if its how you're waiting 10 seconds, maybe its putting the
whole module to sleep instead of a single thread. I have never tried sleeping
a webbroker thread before so I am not sure. If its not that, do you have any
locking around your datetime var, if its global it shouldn't be.

DD
Thanks for your answer:
I removed now all TDateTime vars and function calls.
I replaced them with GetTickCount function. It gives me a integer value
back that represents the time.
The only thing i do now is running in a loop for 10 seconds and
comparing the start time and the current time. I also took Sleep(50)
out.
The problem is still there. Apache does one request after the other.
I also looked into the delphi 7 examples for dso modules. There is
nothing different to my version.
Maybe Apache does not understand that this is a dso module. Maybe it
thinks it is something else and switches to serial mode?
Do I need to work with a different apache version that can load delphi
written dso's.
Or maybe I need to recompile apache with a mdm_winnt?
 

Re:Threading WebBroker WebModule Apache2 Delphi7

Quote
Thanks for your answer:
I removed now all TDateTime vars and function calls.
I replaced them with GetTickCount function. It gives me a integer value
back that represents the time.
The only thing i do now is running in a loop for 10 seconds and
comparing the start time and the current time. I also took Sleep(50)
out.

The problem is still there. Apache does one request after the other.
I also looked into the delphi 7 examples for dso modules. There is
nothing different to my version.

Maybe Apache does not understand that this is a dso module. Maybe it
thinks it is something else and switches to serial mode?

Do I need to work with a different apache version that can load delphi
written dso's.
Or maybe I need to recompile apache with a mdm_winnt?
I write apache dso modules for apache 1.3 and apache 2 in delphi 7, and I've
never noticed this behavior before, but like I said I have never tried to
pause a webbroker thread before. I am going to try something out here, but by
chance you're not running apache with the -X command line option are you? If
so that serializes all requests.
DD
 

Re:Threading WebBroker WebModule Apache2 Delphi7

I tried the following with a apache 1.3 dso module:
procedure TWebModule1.WebModule1WebActionItem3Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
DTB, DTA : TDateTime;
begin
DTA := Now;
Sleep(10000);
DTB := Now;
Response.Content := '<html><body>'+DateTimeToStr(DTA) + '<br>' +
DateTimeToStr(DTB)+'</body></html>';
end;
when I run this in two different browsers I get the following:
Browser 1:
11/10/2006 12:40:45 PM
11/10/2006 12:40:55 PM
Browser 2:
11/10/2006 12:40:48 PM
11/10/2006 12:40:58 PM
Looks like its working fine, if this doesn't work for you then something
else must be off.
DD
 

Re:Threading WebBroker WebModule Apache2 Delphi7

Maybe I should try also Apache 1.3 instead of Apache 2.0.59.
I did patch the http2.pas file the way they describe on this web page
www.drbob42.com/delphi7/apache2040.htm.
Can you tell me the versions you use?
Thanks a lot for your help!
Hasan
 

Re:Threading WebBroker WebModule Apache2 Delphi7

I found the "bug". It was Firefox! If I open two tabs and call my local
web page in both of them it first does the first then the second. The
same with to seperate windows.
Call 1:
StartTime 18:40:22:455
StopTime 18:40:32:877
Call 2:
StartTime 18:40:32:955
StopTime 18:40:42:333
If I call Internet Explorer it does not do that. Everything works fine.
Call 1:
StartTime 18:41:22:455
StopTime 18:41:32:877
Call 2:
StartTime 18:41:23:664
StopTime 18:41:33:332
Does anybody know what it is?
I'm working with Apache 2.0.59 and Delphi 7 and I am creating a dso
module with a TWebModule. Maybe caching?