473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

C application server vs ruby on rails or turbogears

Is there something one can use when leanring c to do the web or are
scripting languages going to dominate the web?
along w java perl ruby ptython tcl etcetc?

I have net seen an open source c application server.....

i saw cserverpages but its $$ for commercial use.....

Oct 18 '06 #1
12 2568
Since web developpment uses a lot of string manipulation, scripting
langage are more appropriate than c for that task.

It is also easier to debug scripting languages, since you can modify
the code and run the page without needs to recompile after modifying
it.

Unless your web site has *really* *really* *really* *really* specific
needs, i would advise not to use C for web development.

gavino wrote:
Is there something one can use when leanring c to do the web or are
scripting languages going to dominate the web?
along w java perl ruby ptython tcl etcetc?

I have net seen an open source c application server.....

i saw cserverpages but its $$ for commercial use.....
Oct 19 '06 #2

"martdi" <ma*********@gmail.comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
It is also easier to debug scripting languages, since you can modify
the code and run the page without needs to recompile after modifying
it.
It is harder to debug scripting languages - type-safe compiled languages
provide you with automatic checking, showing errors and warnings, before
you even run the program.

C programs with CGI (Common Gateway Interface) can serve web pages, but for
three (AFAIK) reasons C programs are not commonly used to serve pages:

1. Scripting languages running under the supervision of a web-server and
"virtual machine" make it easier for the server to recover from errors - the
site stays up

2. scalability - with CGI a new C process is created for every request - a
web server can put less strain on the OS (theoretically I don't see any
problem with C and scalability)

3. web programmers aren't real programmers :-)

I'd be very interested in knowing about ways of serving web pages with C -
anyone?
Oct 21 '06 #3
martdi wrote:
Since web developpment uses a lot of string manipulation, scripting
langage are more appropriate than c for that task.
I dispute this. Please take a look at: http://bstring.sf.net/ and
http://pcre.sf.net/ . With the combination of those two libraries, you
can make C comparable in functionality on strings to any scripting
language in existence.
It is also easier to debug scripting languages, since you can modify
the code and run the page without needs to recompile after modifying
it.
But the C language typically offers better debugging tools. Scripting
language may offer a safer environment that insulates you from the
worst kinds of errors, but on the other hand they often drop things
like "type checking".

An example of this happened to me recently when I was programming some
python and had accidentally used "len" as a variable -- when later on
in the same routine I tried to use it as the default function that it
is, the program just threw an error at run time. This was complicated
by the fact that I was wrapping the whole thing in a try: except: block
to capture other kinds of errors. It was by back peddalling and
literally comparing my code to earlier versions that I was able to
determine what the problem was. The point is that the error was me
redefining the function "len" as a variable, but the interpretor didn't
even offer a warning about this.

So I don't buy the idea that scripting languages are necessarily easier
to debug.
Unless your web site has *really* *really* *really* *really* specific
needs, i would advise not to use C for web development.
Like, performance and/or surviving a slashdot/digg effect?

--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

Oct 21 '06 #4
Paul Connolly wrote:
"martdi" <ma*********@gmail.comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
>>It is also easier to debug scripting languages, since you can modify
the code and run the page without needs to recompile after modifying
it.

It is harder to debug scripting languages - type-safe compiled languages
provide you with automatic checking, showing errors and warnings, before
you even run the program.

C programs with CGI (Common Gateway Interface) can serve web pages, but for
three (AFAIK) reasons C programs are not commonly used to serve pages:

1. Scripting languages running under the supervision of a web-server and
"virtual machine" make it easier for the server to recover from errors - the
site stays up
CGI completely decouples the CGI process.
2. scalability - with CGI a new C process is created for every request - a
web server can put less strain on the OS (theoretically I don't see any
problem with C and scalability)
Probably no worse than loading/interpreting a script.
3. web programmers aren't real programmers :-)
That's changing!
I'd be very interested in knowing about ways of serving web pages with C -
anyone?
The most common use would be as extensions for the likes of PHP.
--
Ian Collins.
Oct 21 '06 #5
martdi wrote:
Please don't top post.
gavino wrote:
>>Is there something one can use when leanring c to do the web or are
scripting languages going to dominate the web?
along w java perl ruby ptython tcl etcetc?

I have net seen an open source c application server.....

i saw cserverpages but its $$ for commercial use.....

Since web developpment uses a lot of string manipulation, scripting
langage are more appropriate than c for that task.
Does it? Looking though my last couple of web projects, I see very
little string processing and plenty of data manipulation. I only used
PHP at my client's request.
It is also easier to debug scripting languages, since you can modify
the code and run the page without needs to recompile after modifying
it.
That's just plain wrong.
Unless your web site has *really* *really* *really* *really* specific
needs, i would advise not to use C for web development.
This is probably true, but not for the reasons listed above. The main
reason is library support.

--
Ian Collins.
Oct 21 '06 #6
gavino wrote:
Is there something one can use when leanring c to do the web or are
scripting languages going to dominate the web?
The (very brief) CGI specification.
along w java perl ruby ptython tcl etcetc?

I have net seen an open source c application server.....
Apache?

--
Ian Collins.
Oct 21 '06 #7

"Ian Collins" <ia******@hotmail.comwrote in message
news:4p************@individual.net...
Paul Connolly wrote:
>"martdi" <ma*********@gmail.comwrote in message
news:11*********************@i3g2000cwc.googlegro ups.com...
CGI completely decouples the CGI process.
excellent point. Thank you for correcting me.
>2. scalability - with CGI a new C process is created for every request -
a
web server can put less strain on the OS (theoretically I don't see any
problem with C and scalability)
Probably no worse than loading/interpreting a script.
not sure that is true in practice - or am I just a fool for the IIS
"marketecture"?
>3. web programmers aren't real programmers :-)
That's changing!
yes it is!
>I'd be very interested in knowing about ways of serving web pages with
C -
anyone?
The most common use would be as extensions for the likes of PHP.
I haven't done PHP (my employers uses ASP - but I might be able to influence
them otherwise - if I'm convinced myself) - can you recommend a good book to
read? or good URL? (ideally an example of read from db - put it on the
page - retrieve edited data - write to db).
Oct 21 '06 #8
>C programs with CGI (Common Gateway Interface) can serve web pages, but for
>three (AFAIK) reasons C programs are not commonly used to serve pages:

1. Scripting languages running under the supervision of a web-server and
"virtual machine" make it easier for the server to recover from errors - the
site stays up
It's hard to imagine a non-malicious CGI program, written in any
language, that will take down the web server for reasons other than
taking too many resources. (I consider kill(getppid(), 9) malicious).
And C programs tend to take fewer resources than scripting languages
for a given task. CGI runs in a separate process.

Something like PHP run as an Apache module CAN take down the web server,
since it's capable of scribbling on memory where it shouldn't. I've
had this happen (I think it was incompatible module versions). It's
very rare, though.
>2. scalability - with CGI a new C process is created for every request - a
web server can put less strain on the OS (theoretically I don't see any
problem with C and scalability)
C processes, although separate, tend to take up a lot less memory than
a scripting language PLUS a webserver in the same process.

>3. web programmers aren't real programmers :-)

I'd be very interested in knowing about ways of serving web pages with C -
anyone?
Sometimes it's as simple as taking an existing C program that outputs
something useful on stdout and having it add a Content-type: text/plain
header at the beginning of its output. I've even done that with a
shell-script wrapper.

The advantage of web-based scripting language is that they've already
got the infrastructure for things like accepting input variables and
cookies done for you, and throwing something together quickly is much
easier to do.

Oct 21 '06 #9

"Gordon Burditt" <go***********@burditt.orgwrote in message
news:12*************@corp.supernews.com...
The advantage of web-based scripting language is that they've already
got the infrastructure for things like accepting input variables and
cookies done for you, and throwing something together quickly is much
easier to do.
a web page written by a C program could preserve a (suitably encripted and
verifiable) identification of session state, input is easily parsable from
the environment or stdin - this infrastructure could be written easily in
C - there are already libraries in C for doing it
http://cgi.resourceindex.com/Program...s_and_Classes/
It looks to me that there is little extra work to get started with C, but
not much.
(I know this sounds mad but I was wondering about developing a web-site in
assemler).
Oct 23 '06 #10
>The advantage of web-based scripting language is that they've already
>got the infrastructure for things like accepting input variables and
cookies done for you, and throwing something together quickly is much
easier to do.
a web page written by a C program could preserve a (suitably encripted and
There's a lot of things a C program *COULD* do, but that doesn't
come with C. Not even the basics like separating out the values of
GET or POST variables, to say nothing of handling sessions. And
chances are you won't find the third-party libraries for this already
installed on the servers you want to use them on.
>verifiable) identification of session state, input is easily parsable from
the environment or stdin - this infrastructure could be written easily in
C - there are already libraries in C for doing it
http://cgi.resourceindex.com/Program...s_and_Classes/
It looks to me that there is little extra work to get started with C, but
not much.
(I know this sounds mad but I was wondering about developing a web-site in
assemler).
After all, you *CAN* write something like PHP or Perl in C and/or C++.

Oct 25 '06 #11
we******@gmail.com wrote:
martdi wrote:
Since web developpment uses a lot of string manipulation, scripting
langage are more appropriate than c for that task.

I dispute this. Please take a look at: http://bstring.sf.net/ and
http://pcre.sf.net/ . With the combination of those two libraries, you
can make C comparable in functionality on strings to any scripting
language in existence.
bstring is awesome but it's still behind the functionality of most
modern scripting languages. e.g. there's no support for character
encodings, many of the lib functions are very specialized (there's
btrimws but no generalized strip/lstrip/rstrip that lets the user
select what characters to strip), and it lacks things like tab
expansion, console text justification, etc. I didn't even see a simple
reverse function but I might've missed it.

That's not necessarily a knock; if you're going with C, you probably
want a leaner API. But scripting languages tend to have tons of little
helper functions that can make life easier on the programmer.
It is also easier to debug scripting languages, since you can modify
the code and run the page without needs to recompile after modifying
it.

But the C language typically offers better debugging tools. Scripting
language may offer a safer environment that insulates you from the
worst kinds of errors, but on the other hand they often drop things
like "type checking".
Python and Ruby are both much more strongly typechecked than C.
Whether static or dynamic typing is better is an argument that's been
had out a million times and is off-topic anyway (certainly if you're
used to one it takes a while to adjust to the other).
Unless your web site has *really* *really* *really* *really* specific
needs, i would advise not to use C for web development.

Like, performance and/or surviving a slashdot/digg effect?
We had no problems serving 300 pages/second from a python-based
solution when I was working at a large web company, and the servers
weren't breathing hard (We were, in fact, slashdotted but the traffic
spike just isn't very noticeable to a larger site). CPU usage was only
in the 10% range, we had 4 servers (moderately sized intel or amd
boxes) for redundancy but 1 was an offline backup. That was peak
traffic in special events; average peak daily was significantly lower.

CPUs are fast and putting together web pages isn't very
compute-intensive; the problem tends to be (1) the network being
saturated; (2) running out of file descriptors or other resources if
your server architecture is poor or (3) the database falling over,
again normally an architecture/design problem.

That said, the dynamic content server which had to serve several
requests for each page view was a custom C solution. It handled
probably 1500-2000 requests/second during peak special traffic with
next to no CPU usage, but it also had the luxury of having persistant
connections to the web farm (they obviously had to set up and tear down
TCP connections for most incoming web requests).

FWIW, it was entirely written in ANSI C except for network socket calls
and file descriptor passing so that it could be upgraded seamlessly
without losing connections to the web servers--all the logic for
parsing and processing a request and determining a response was
bog-standard. It was taken out of production some time this year but
by then had served several billion requests with no unscheduled
downtime.

So for certain types of web solutions, C can work very well indeed.

Oct 25 '06 #12
"Paul Connolly" <pg********@blueyonder.co.ukwrites:
C programs with CGI (Common Gateway Interface) can serve web pages, but for
three (AFAIK) reasons C programs are not commonly used to serve pages:

1. Scripting languages running under the supervision of a web-server and
"virtual machine" make it easier for the server to recover from errors - the
site stays up
CGI decouples the CGI-spawned process from the web server process.
This is not a problem.
2. scalability - with CGI a new C process is created for every request - a
web server can put less strain on the OS (theoretically I don't see any
problem with C and scalability)
With any programming language used through the CGI a new process is
created for each request. There are ways of getting around this
(FastCGI, Apache modules), but they're either "as-if" extensions to
the CGI spec or they don't use the CGI at all.
3. web programmers aren't real programmers :-)
This is a major reason -- most of the HTML or Dreamweaver monkeys
calling themselves web programmers couldn't handle C.

You also missed out

4. effort/reward ratio

The principal advantage of using C is its tight coupling with the
machine and its close mapping to actual machine language. In the web
environment, this isn't nearly as useful, because network bandwidth
and latency are more of a constraint. And so it's acceptable to trade
away performance for ease of development, and a language that has
strings as a first-class data type has big wins here.
I'd be very interested in knowing about ways of serving web pages
with C - anyone?
Read the CGI spec. If you can parse the contents of environment
variables and spit out plain text, you can write CGI code in C. It's
not done much because it's a poor tool for the job.

Alternately, take a look at the Apache source, and learn how to write
Apache modules to handle different phases of the request.

Charlton

Oct 25 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jean Paul | last post by:
Can someone explain to me what java enterprise edition is?? I've been looking into the web for some info, but can't really make sense of the info found. Is there also an tutorial avaible? I've...
3
by: Varkey | last post by:
Dear friends, I am new to .NET based app development and have a pretty elementary query, I suppose... I have caught up with the basics of .NET pretty well, thanks to some Microsoft VB/ASP...
4
by: Chris Gatto | last post by:
Hello, My organization is currently considering the purchase of a new intranet application server and we are looking for opinions from those who have been down this road before. In brief the...
3
by: DMina | last post by:
Hello there! I have the following configuration. Two AIX Servers: the first is server as an application server (SAP SEM) and the second as the database server (DB2 V7.2 with FIXPAK 12). The...
7
by: Vincent Delporte | last post by:
Hello I'm interested in hearing reflections by seasoned web app developpers about the different ways to write PHP apps, and especially how they compare in terms of performance, whether it's the...
3
by: =?Utf-8?B?QkY=?= | last post by:
In Microsoft architecture diagrams, I always see 3 layers of application structure: web server, application server and database server. Web server is IIS. Database server is SQL server. What...
1
by: jchau | last post by:
Is anyone has any idea what i need to do if i would like to integrate the IIS with other application server, where the IIS will serves as a front end web server and forward the request to the...
0
by: sathyguy | last post by:
when i type the below in my RHEL AS 4's Firefox 1.5 http://appsworld.ncc.com:7777/forms/...&form=test.fmx iam getting the below error... The requested URL /forms/frmservlet was not found on...
8
dmjpro
by: dmjpro | last post by:
What's the difference between Web Server and Application Server. I had an idea that Web Server only able to serve the static pages and Application Server able to serve dynamic pages. One more thing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.