-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Neven,

On 11/20/13, 11:48 AM, Neven Cvetkovic wrote:
> Ultimately, CGI is a very old technology that had its own share of 
> performance (and security) problems. Usually, CGI scripts were
> replaced with superior Java Servlet technology (or some other
> better technology) and hence the need for Tomcat application server
> (servlet container). Hopefully, the rest of the mailing list
> members share my sentiments about the CGI :)

- -0

The only thing that really makes CGI "outdated" is that CGI itself
didn't have an API... or if you could call it an API, it was very
basic. It basically said "you get the query string in a big blob and
you can read standard input if you want to get the entity body". Then
everyone set to work writing their own custom parsing routines. I
remember copy/pasting stuff in Perl way back in 1994 and now having
any idea what the code actually did.

These days, you can pretty much write a Perl script and say "use CGI;"
and it's just magic, safe, etc. CGI has come a long way.

The last remaining problem is really that of performance: the CGI
model launches a new process for each request (even though you can
cheat a bit using things like mod_perl, etc.) and so there is a
performance hit right there. If you want to keep information between
requests, you have no choice but to write it to some form of
non-volatile storage (as far as the "application" is concerned).
RDBMS, flat file, etc.

More recent systems (I hesitate to say "modern" because it implies
that they are better simply because they are newer, and that the older
methodologies are simply worse by definition) are supported by much
more complicated software, APIs, etc.

Note that container-based systems like Tomcat have their own
performance problems: they have to manage all the stuff that they are
... well, required to support. If you peel-away all of the stuff that
Apache httpd provides *aside* from the Common Gateway Interface, you
are left with a server that primarily pumps bytes back and forth
between the client and the script. Tomcat has all kinds of moving
parts that make it possible to do nice things, but those moving parts
have a cost.

(It's worth noting that I believe such costs are worth it. That's why
I live in the container-based world instead of writing Perl- or
PHP-based applications.)

Want to deploy a single "Hello, World!" CGI script? No problem. Just
drop "#!/bin/sh\n\necho "Hello, World!" into a .cgi file in your
document root and tell Apache httpd it's okay to run it.

Want to deploy a single "Hello, World!" script on Tomcat? Well, first
you have to know where the auto-deployment directory is (hint: it's
not a document root), and then you have to create a directory in
there, and then drop a .jsp file in there. The good news is that
"Hello, World!" is a valid JSP file without any of the fluff you need
to make a shell script run. But the small amount of orientation
required just to get the point of dropping text into a file can be
confusing.

Once the almighty "container" is involved, there is pressure to make
it do more things. Sessions. Replication. Websockets. These are all
very good and very useful things, but it further complicates the
scenario. It's just a tough world to jump into with little to no planning.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSjrUUAAoJEBzwKT+lPKRYdcsQAIWqzHUbSimrUmXcYw9KH0zs
fkZCQvi3Hqon1afyun6fU+NT8Ta0YkOYKW8gEiWvrogcZtMl1Q/oxOKSWZvPG8g1
8nPyDbACRL2715VUKuWgCTfABuQnHYOjFuakqAfZsXcVigxfpwWyw8eS7KfwpaDv
vr/ZwqDv2ThQs63rk2rO5HW9o65nk2+XX4RBaUAw6lRZ7AfKMH5upR5Qwe231aKR
DBF6GsuoWGeyONPXyGGIcrjLeizg1pOf1m0W3cTTIgI6UBNFUez+hZHGpFxbkrNE
FX3onEVfrjlaxfSFmDx4ytDyOo973fhMALrasvIUSPqdKhjvIFHTYarZHRrOxex1
/L+YWnth7xAWTHPz+SzM7YWzRTDfWeOMq9PCx8wdoV88BJ35tQerxowdvbo+fPJN
S+Y+zw2iZwlyN8bVfwVpG81my8SEtFgrxhyPZMTqDK8RppL1QlC+aemQHiafTwoH
78+JP1HRR/tgYM9WXsDmOhIFgZp2pjATvuklqc5gw7BWX6J9UF8LjqEAmgwj5/KI
JlcMgCLH91WvjU/7p0jFnTMGHalL8Bz4L4KFp9OwA4gwkvjZQF1q1MbEGU/GVHP+
z2hJHeC4ugXk9zzO9imlUMZhC/pNGkwc/5leSMaHhwd0uZMatKh3sM4LLmoptiDP
0/kSWWI/zKK0USODk240
=21G3
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to