PowerBASIC Forums
  PowerBASIC Console Compiler
  PBCC and CGI (Page 1)

Post New Topic  Post A Reply
profile | register | preferences | faq | search

UBBFriend: Email This Page to Someone!
This topic is 2 pages long:   1  2 
next newest topic | next oldest topic
Author Topic:   PBCC and CGI
Steven Pringels 3
Member
posted March 23, 2004 03:52 PM     Click Here to See the Profile for Steven Pringels 3     Edit/Delete Message   Reply w/Quote
Hi fellows,

I was wondering about this. Are there any major sites that
use a PB/CC CGI program out there that can support hundreds
of users (maybe 1000s ?). I don't want to start a ISAPI based
application although it has its benefits. I am currently
investigating two possibilities

1. PB/CC and hopefully they come out with a Linux version somewhere
in my lifespan.

2. PHP 5.0 - multi platform however lots of reprogramming to do.

If you have an example of a CGI app that you (or somebody else)
wrote and want to show it online please feel free.

As a side question. What is the best Webserver that you use for
PB and CGI ? I use Apache since it is free. Is this OK ? Or do
you think there are better ones ?

------------------

IP: Logged

Edwin Knoppert
Member
posted March 23, 2004 04:27 PM     Click Here to See the Profile for Edwin Knoppert     Edit/Delete Message   Reply w/Quote
I still use the obsolete omnihttp for CGI.
And an unregistered Falcon webserver for ISAPI.
http://www.blueface.com

We use CGI for dl of our apps a bit more secure.
But the webserver is a pain in the ... anyway.
To upload (to user) big parts, chunk them in small fragments like < 64kb so the memory isn't claimed to much.
Earlier i did obtain the exe in a string variable first.
The WS does not like that (10MB)

------------------
http://www.hellobasic.com
Freeware and commercial tools for PowerBASIC
PBSoft - Netherlands

IP: Logged

Edwin Knoppert
Member
posted March 23, 2004 04:28 PM     Click Here to See the Profile for Edwin Knoppert     Edit/Delete Message   Reply w/Quote
BTW,
Our WS is IIS (4.x i believe, soon MS webserver2003)

------------------
http://www.hellobasic.com
Freeware and commercial tools for PowerBASIC
PBSoft - Netherlands

IP: Logged

Lothar Pink
Member
posted March 23, 2004 04:35 PM     Click Here to See the Profile for Lothar Pink     Edit/Delete Message   Reply w/Quote
Steven,

Why don't you want to use ISAPI?

Best Regards

------------------

IP: Logged

Shawn Anderson
Member
posted March 23, 2004 05:44 PM     Click Here to See the Profile for Shawn Anderson     Edit/Delete Message   Reply w/Quote
Steven,
I don't know about 1000's, but I have a site that gets
hundreds of simultaneous users. www.followthesigns.com

I was taught to program everything on the client side until
you have to use the server. The reason is that you take much of the
overhead from the server and put it on the client machine.
On this site, I use javaScript for the shopping cart, and only
use CGI (pbcc) to manipulate the database.

We use IIS5. We have about 50 websites running on that server.
You really don't need much horsepower to run a web server, unless
you are running a hog like SQLserver or something.
Ours is something like a 500mhz with 384mb RAM.

I too am waiting for PBLinux. We want to switch to Linux
webservers (we've already switched many of the other server
functions to Linux). The ONLY reason we haven't switched to
100% Linux is because I use PBCC on some sites and need Win32.

------------------
http://www.nbson.com
CIW, A+

IP: Logged

Terry Fritts
Member
posted March 23, 2004 06:03 PM     Click Here to See the Profile for Terry Fritts     Edit/Delete Message   Reply w/Quote
I don't know about major sites using PB/CC CGI specifically.
But there are plenty of high traffic sites using CGI applications
for various things.

Capactiy really depends on the number of concurrent or simultaneous
users, the work the program must accomplish, the bandwidth, and the
hardware. Testing is pretty tricky in its own right. I have
successfully tested CGI and ISAPI programs into 200+ pages per
second range with 40 concurrent users. That's pretty heavy usage.
Normally your pages per second rate will climb with concurrent
users to a certain maximum and then begin declining afterwards.
Best thing to do is capactiy testing as you develop.

If you need to connect to a database then you can pare that down
considerably because the database server will be the limiting
factor.

CGI will load the program and any libraries and execute and unload
for each request. ISAPI will load once but if you have database
then you must manage your own threads from the ISAPI. Or at least
that's my experience.

I don't really have current experience on Apache but lot's of
cgi programs running on it.

IP: Logged

Don Dickinson
Member
posted March 23, 2004 06:56 PM     Click Here to See the Profile for Don Dickinson     Edit/Delete Message   Reply w/Quote
thousands ... no, but hundreds might be ok.
pbcc apps (at least v2.x) allocate a 1mb stack per instance. if you have 5 simultaneous hits, you have a minimum of 5mb of ram gone.
isapi could maybe handle this kind of load BUT a lot would depend on what that app is doing.

best regards,
don

------------------
Don Dickinson
Author of ddoc Print and Preview A dll-based print-preview engine for windows
www.greatwebdivide.com
Author of Tsunami Tcp Data Server
http://ttds.greatwebdivide.com

IP: Logged

Steven Pringels 3
Member
posted March 24, 2004 02:49 AM     Click Here to See the Profile for Steven Pringels 3     Edit/Delete Message   Reply w/Quote
Hi Lothar,

The reason for ISAPI is that

1. I have to use IIS for this
2. If the DLL crashes every single connection to that DLL crashes
with it so all users get disconnected. With CGI that problem doesn't
exists.

The reason why I am also looking at PBCC is that I hope that PB will
come up with looooooonnnnnng awaited Linux version sometime. Furthermore
I have done a bit of PHP here and there and it is nice but what bothers me
is the variable type freewheeling. I mean there is no type checking every variable
can be every type. Also there is no notion of a Struct (or Type in PB) and my
app server uses Types extensively so I would have to resort to streams (in PHP).
then, there is no functionality in PHP like MkDwd or CvDwd and all that bothers me
a bit. I probably could write all these 'basic' functionalities' in PHP but I guess
it should be there standard.

The nice thing about PHP is that one can *dynamically* construct scripts. So the
application server could put out php files that are generated on
the fly.

So the basic setup would be

Client (webbrowser) <---> WebServer <--> executes CGI proggy or PHP <--> connects to App Server <--> RDBMS

Of course CGI is just a matter of how much memory and processing power you throw in the
machine. The more the merrier.

So for me the decission is whether to do it with PB or with PHP.
ASP or ASP.Net is out of the questino. Coldfusion as well. JSP...
hm, too much work.


Shawn:

I completely agree with your statement. Validation of e.g. phonenumber formats or
CC formats should be done on the client and not on the server. The round-trip effect
put too much on bandwidth and server.

------------------

IP: Logged

Terry Fritts
Member
posted March 24, 2004 08:53 AM     Click Here to See the Profile for Terry Fritts     Edit/Delete Message   Reply w/Quote
With ISAPI you can control the traffic.

If your load testing indicates you might have problems after
5 threads then you can force a time delay beginning with the 6th.
You might even increase the delay as more and more requests hit
the server.

Another great benefit of using PB and ISAPI is that you can use
http compression. If you are concerned about traffic then that
is one huge reason.

I'm really puzzled why you eliminate ASP since it is an IIS web
server and you are considering PB. ASP and VB seems more natural
and ASP performance is excellent.

If you like PHP syntax then you might want to use PerlScript in
ASP although your performance will not be as good in my experience.
You can use the eval in PerlScript much like you discuss in PHP
although for me that is one of those ideas that seemed really good
and ended up being more trouble than anticipated.

The great advantage of PHP in my opinion is the number of functions
and packages that are available. But for me there is just no joy
in writing in it.

Regardless of the language or type any web server can be made
practically non-performing given sufficient load. In your case
since you are going to an app server and a db then you have those
limitations which will be far more limiting than the web server
application.

JavaScript client side is becoming more and more a problem in my
opinion. Lots of people now turn JavaScript off as a security
precaution. The incompatibilities between browsers continues to
be a problem. Plus you have the problem of hackers. So you
pretty much have to validate server side even if you do so client
side.

[This message has been edited by Terry Fritts (edited March 24, 2004).]

IP: Logged

Lothar Pink
Member
posted March 24, 2004 10:40 AM     Click Here to See the Profile for Lothar Pink     Edit/Delete Message   Reply w/Quote
quote:
Originally posted by Steven Pringels 3:
Hi Lothar,

The reason for ISAPI is that

1. I have to use IIS for this
2. If the DLL crashes every single connection to that DLL crashes
with it so all users get disconnected. With CGI that problem doesn't
exists.


1. Apache also supports ISAPI. Is the web server yours? If yes, write your own server - just modify
an existing HTTP server (source code available here I guess).

2. While testing and debugging, you can run ISAPI extensions uncached and isolated.

You should prefer CGI exes over Perl/PHP because of speed. Although the EXE file will be re-read each
request, it will be cached in the hard disk cache.

You might also consider to use a small CGI EXE which puts the request to a big DLL which processes it.
The (non-ISAPI!) DLL will be cached in memory, and you can do initialization for all instances.
Regards

------------------

IP: Logged

Edwin Knoppert
Member
posted March 24, 2004 11:48 AM     Click Here to See the Profile for Edwin Knoppert     Edit/Delete Message   Reply w/Quote
Lothar,

Give me a simple example of an ISAPI webserver written with PB..
I'm interested how the handle is created..

------------------
http://www.hellobasic.com
Freeware and commercial tools for PowerBASIC
PBSoft - Netherlands

IP: Logged

Lothar Pink
Member
posted March 24, 2004 03:00 PM     Click Here to See the Profile for Lothar Pink     Edit/Delete Message   Reply w/Quote
You don't need an ISAPI supporting webserver. Just one which searches if a DLL is present,
and calls 3 - defined by you - callback functions

Load
Unload
ProcessRequest(reqstr AS STRING)


Why support ISAPI?
Even when you want to do that, you "only" need to provide the ECB structure and the callback
function.

------------------

IP: Logged

Edwin Knoppert
Member
posted March 25, 2004 04:04 AM     Click Here to See the Profile for Edwin Knoppert     Edit/Delete Message   Reply w/Quote
Thought you wrote one (sigh)

You are forgetting the connid (handle)
This is the handle from WS to ISAPI DLL to respond to..

------------------
http://www.hellobasic.com
Freeware and commercial tools for PowerBASIC
PBSoft - Netherlands

IP: Logged

Don Dickinson
Member
posted March 25, 2004 10:06 AM     Click Here to See the Profile for Don Dickinson     Edit/Delete Message   Reply w/Quote
the conn id isn't a big deal. it's a number that the ws uses to keep track of which instance of the isapi dll it is calling.
if it was me, the connid would just be a pointer to a structure holding information about that instance. could also be an array index or whatever.
--don

------------------
Don Dickinson
Author of ddoc Print and Preview A dll-based print-preview engine for windows
www.greatwebdivide.com
Author of Tsunami Tcp Data Server
http://ttds.greatwebdivide.com

IP: Logged

Edwin Knoppert
Member
posted March 25, 2004 10:35 AM     Click Here to See the Profile for Edwin Knoppert     Edit/Delete Message   Reply w/Quote
OK, please make a working example, i tried (ever)

------------------
http://www.hellobasic.com
Freeware and commercial tools for PowerBASIC
PBSoft - Netherlands

IP: Logged


This topic is 2 pages long:   1  2 

All times are EasternTime (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | PowerBASIC BASIC Compilers

Copyright © 1999-2005 PowerBASIC, Inc. All Rights Reserved.


Ultimate Bulletin Board 5.45c