Gossamer Forum
Home : Products : Gossamer Links : Discussions :

LSQL under FastCGI

Quote Reply
LSQL under FastCGI
Has (will) FastCGI support been (be) built into LSQL? If not, then how can LSQL be modified to run under FastCGI (e.g., putting script into while loop)?



Cheers - Dan Cool



----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln
Quote Reply
Re: [dan] LSQL under FastCGI In reply to
Hi,

No, its never been tested under FastCGI. Remarkably, we've never had a client using it, it's always been mod_perl or SpeedyCGI. I don't think it would be too hard, you would just want to do:

while (...) {
$GT::Base::PERSIST = 1;
Links->reset_env;
main();
}

and it should work fine.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] LSQL under FastCGI In reply to
Hi Alex:

Thanks! Thinking it over, I'm going to install SpeedyCGI instead - via Standard Install. Is it necessary to edit httpd.conf? Or just reinstall LSQL - setting [Perl Path] to /usr/bin/speedy, and [persistent env] to YES?

Cheers - Dan Cool




----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln

Last edited by:

dan: Dec 29, 2001, 1:22 AM
Quote Reply
Re: [dan] LSQL under FastCGI In reply to
Hi,

Nope, no changes are neccessary at all. All you need to do is set the path to perl to /usr/bin/speedy.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] LSQL under FastCGI In reply to
One last question. What about [persistent env]? No need to change, or if yes, how? The reason I ask, is I recall from awhile back GT post regarding setting up LSQL to run under SpeedyCGI, that it was mentioned to enable this variable (via reinstalling LSQL).

Cheers - Dan Cool



----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln
Quote Reply
Re: [dan] LSQL under FastCGI In reply to
Hi,

No, that has not been neccessary for quite some time (2.0.3 I believe).

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] LSQL under FastCGI In reply to
Perfect - thanks Alex!

Cheers - Dan Cool



----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln
Quote Reply
Re: [Alex] LSQL under FastCGI In reply to
More info about FCGI & LSQL?

I got suggested that it's better to use FCGI, than Speedy. Mod_perl is not suggested at all, because some people says it is a crap (can cause problems in webserver).

Some Perl junkies suggest FastCGI. SpeedyCGI is not known so well...

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] LSQL under FastCGI In reply to
Hi,

Last time I looked, FastCGI requires changes to your code (wrapping your code inside of a while FastCGI->accept() loop). The advantadges to SpeedyCGI is that it is much simpler to setup and use. All you do is change the path to perl from #!/usr/bin/perl to #!/usr/bin/speedy and you are done! Also, it can be installed locally, and you don't need to be root to use it.

We recommend mod_perl for dedicated servers as it gives you more access to the webserver. I've been using it for over 5 years now, and our hosting packages come with it standard, so your friend probably does not understand it or know how to set it up properly (it is much more complex then SpeedyCGI).

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] LSQL under FastCGI In reply to
Yes, I also saw in docs, FCGI needs a while loop around your code.
It could be possible to wrap codes in cgi files, like page.cgi. That should work, shouldn't?

The question is mainly not if is it possible or not (should be possible anyway), but if you want to add support for FastCGI or not, in a later LSQL release.

Speedy. Yes, in case of LSQL, using Speedy is much easier, since LSQL takes care about changing the shebang line in all cgi-s. But I have doubt, that this will be crossOS solution. Likely it will not work on Windows without further tricks (like creating /usr/bin/ dir & copy speedy to there). On Windows, Apache by default does not use the shebang line, but use registry to start Perl. As I know, registry feature can be turned off, but I never tried, yet.

About mod_perl. On channel #perl on ircnet, perl experts wrote:
- "running perldemons in the same address space as the webserver is borken",
- "everything that doesn't run in the same process space as the webserver is better than mod_perl",
- "with a fastcgi-like system you gain the speed of mod_perl _and_ a lot of extra security and functionality"
Q: "What is the disadvantage of running scripts in the same process space as the webserver?"
A: "1) security: if your CGI is borken, your server is toast
2) authentication: you MUST use as the apache user instead of the user you are
3) dispatching: you will run as many demons as there are apache processes, but there is no reason to think that the popularity of your script = popularity of your server
4) dependability: if my apache or perl coredumps, I don't want the other to die too"

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] LSQL under FastCGI In reply to
Take a look at what the "experts" have to say on the issue.

http://www.take23.org/whatis_mod_perl.xml

Also, at

http://modperl.com:9000/ (Lincoln Stein's site)

mod_perl is much, much more than a wrap around, or extension to .cgi. Trying to compare the two, or what mod_perl *really* is, is almost silly. The end effect may *appear* to be the same, but how you got there, or what is going on, is *completely* different. It's actually a link into the Apache API. BTW... if one of your processes coredumps, be it Apache or Perl, you will loose the functionality other anyway. Think about it.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [webmaster33] LSQL under FastCGI In reply to
Hi,

Quote:
It could be possible to wrap codes in cgi files, like page.cgi. That should work, shouldn't?


No, it will take more work then that. Links SQL needs to be aware that it is under a persistent environment so it can reset globals per request. Also, there are a number of performance increases Links SQL does if it knows it is under a persistent environment (pre load subroutines, cache objects, etc).

Quote:
but I have doubt, that this will be crossOS solution


No, it will only work on unix type systems. On Windows, we recommend using PerlEx from Activestate, as we don't recommend Apache for Windows. However, if you are on almost any type of Unix, SpeedyCGI can be implemented easily on a per script basis, or on groups of scripts. It does not require integration into Apache (so you can run it without root/control of the webserver), however you can integrate it into apache if you have that access for even faster execution (but if you have that level of access, we recommend mod_perl).

As for the mod_perl comments, all the comments seem to reflect running mod_perl integrated into the main webserver, something that's not recommended. The best way to run mod_perl applications is as a proxied backend application server as described on perl.apache.org. That takes care of pretty much all your points you describe. You can run it as whatever user you like; if it breaks, only your script breaks; you have apache's fine tuning of how many daemons to run. This is how we have it setup on our servers. It allows a virtual account to use mod_perl, while not endangering any other accounts.

You need to look at is as Apache providing the ability to handle the spawning/daemon management/io, something that it has been proven to do well, rather then re-implementing the wheel with SpeedyCGI or FastCGI.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [pugdog] LSQL under FastCGI In reply to
About the mod_perl I just quoted some opinions. They was opinion of others. My main question was if FastCGI will be implemented in future or not. The other question was if Speedy is crossOS ability.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [Alex] LSQL under FastCGI In reply to
Well, now I understand that there can be good & safe solution using mod_perl. However it is not very likely, that my hosting service provider will provide proxied backend application server for me (and I need a server located in my country), since I'm just on a virtual server.

So FCGI or Speedy would be the solution for me. FCGI is currently not supported by LSQL. Speedy may be the solution if I can use on both Windows & Linux.
I develop scripts/plugins/site on Windows/Apache local machine and I use them on Linux/Apache server.
That's why I need crossOS solution.

Quote:
recommend using PerlEx from Activestate, as we don't recommend Apache for Windows
I do not want to use a PerlEx on Windows, but Speedy or FCGI instead, if possible.
I understand that Apache for Windows is not a mature product, but for my base developments it is good enough. Later when I finish/fine tune the scripts online on Linux/Apache server.

You may suggest me to use Linux for developments, but all the required & mature development software are Windows based, therefore I can not move my developments to Linux at this time. I used Linux for a few months, and I searched the for best development tools which has same or similar features like I currently have. They was not good enough for me, so I have to wait a bit to move to Linux.

Persistent environment is not required suddely for my site. But I know I will have to change to persistent environment likely in year 2003.

- mod_perl is not good for me
- if FastCGI will be supported by LSQL could be the crossOS solution for me. Will be sometime? Planned at all?
- Speedy? I do not know if it can be correctly used on both Windows & Linux. Any additional info are welcome.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] LSQL under FastCGI In reply to
SpeedyCGI is not supported on Windows.

As for FastCGI, no, we have no plans at this time to support it.

I would recommend you setup a second linux server to test on locally. i.e. setup an old computer to be the linux server, and use Samba to access files on the server from within Windows Explorer. That way you can mirror your live site and your development site very closely, while still working with your windows development tools.

Quote:
However it is not very likely, that my hosting service provider will provide proxied backend application server for me


Do they provide FastCGI support? That is almost the exact same thing: A backend application server.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] LSQL under FastCGI In reply to
Alex,

I noticed that AdPro recommends that you run their ad software on FastCGI. How have you tackled this issue with the plugin?

Thanks,

Bryce
Quote Reply
Re: [Demolitioncrew] LSQL under FastCGI In reply to
Hi,

You can use both technologies at the same time. Also, we have succesfully run AdvertPRO under SpeedyCGI without too much trouble.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] LSQL under FastCGI In reply to
Alex when I installed the advertpro plugin everything worked fine, but now that I have LSQL working under mod_perl, advertpro doesn't work right. Its not giving error messages, it is just exhibiting strange behavior such as:

It won't take my password, but if I enter it about 4 or 5 times, the opening screen with the system information displays, but none of the navigation links work at the top to go to campaigns, banners, etc. If I click on the dropdown list and hit "go", it will sometimes (but not always) load the navigation bar again in the lower-frame. Any thoughts on how I can fix this or get more information to make it more clear?

Thanks,

Bryce
Quote Reply
Re: [Demolitioncrew] LSQL under FastCGI In reply to
Hi,

AdvertPRO won't work under mod_perl. You'll need to run it under FastCGI, regular CGI or SpeedyCGI.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] LSQL under FastCGI In reply to
In Reply To:
Hi,

AdvertPRO won't work under mod_perl. You'll need to run it under FastCGI, regular CGI or SpeedyCGI.

Cheers,

Alex


AdvertPro does work under full mod_perl, just make sure you have latest version for this compatibility.

~ ERASER


Free JavaScripts @ Insight Eye
Quote Reply
Re: [Eraser] LSQL under FastCGI In reply to
Ah, my mistake. Last I spoke to Wade it didn't. =) Glad to see they got it working!

Cheers,

Alex
--
Gossamer Threads Inc.