OT: 'best' dynamic language

Hi,

due the fact that here are a lot of peoples who care about fast and
light environments so I just ask :wink:

What do YOU think is the ‘best (smallest/fastest/easiest)’ language to
develop a dynamic website?

The requirements are:

MySQL requests (insert/update/delete)
Generate HTML-Files with templates => static files
Work with nginx :wink:
As small as possible mem and cpu usage => efficient interpreter

I have thought about the followings (no order):

perl
python
ruby
php
java
haxe (http://haxe.org/)
lua (http://www.lua.org/)
io (http://www.iolanguage.com/)
.
.
.

I know about

http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all

but this page don’t tell me how the language behave underload or when
there is a problem with the IO (network/disk/…)

Thank you for your opinions :wink:

Cheers

Aleks

go with django it’s a web framework based on python with excellent
documentation and super ease of use.

they abstract database interface for you,

built-in template system

ready to use admin interface (to manage users) and comment system

at djangoproject.com

-Bedros

Aleksandar L. ha scritto:

MySQL requests (insert/update/delete)
Generate HTML-Files with templates => static files
Work with nginx :wink:

Well, any language will work with Nginx, as long as it has an
HTTP/FastCGI/SCGI server implementation.

As for languages embedded inside Nginx, the only choices at the moment
are Python and Perl.

As small as possible mem and cpu usage => efficient interpreter

The memory usage usually depends on the package you use.
The python interpreter in mod_wsgi takes about 3616 KB in the master
process and 1908 KB for each worker.

.
io seems interesting, I did not knew it.

Lua seems the best choice, however it does not have all the packages
available for Python and Perl.

I’m very interested in developing a module for lua (or io), mostly for
testing the best possible integration with the Nginx event module.

For mod_wsgi I have implemented the ngx.poll extension:
http://hg.mperillo.ath.cx/nginx/mod_wsgi/file/tip/examples/nginx-postgres-async.py

but it’s not very usable yet.

For really scalable applications you can also consider Erlang;
unfortunayely its syntax is not good, but many use it since there are no
better choices (Haskell is interesting too, but it is not as mature as
Erlang for network applications - and this is very unfortunate)

.
.

I know about

http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all

but this page don’t tell me how the language behave underload or when
there is a problem with the IO (network/disk/…)

You can test it with Nginx mod_perl and mod_wsgi.
However if the application is IO bound, then the performance are not the
best.

Thank you for your opinions :wink:

Cheers

Aleks

Regards Manlio P.

On Mon, 2008-04-21 at 00:26 +0200, Manlio P. wrote:

I’m very interested in developing a module for lua (or io), mostly for
testing the best possible integration with the Nginx event module.

I’d like to see Lua as a replacement/alternative for Nginx’s Perl
module. Unlike most dynamic languages, Lua was originally designed to
be embedded. I find its syntax much cleaner than Perl and it
undoubtedly has a much smaller memory footprint.

Regards,
Cliff

On Son 20.04.2008 15:22, Bedros Hanounik wrote:

go with django it’s a web framework based on python with excellent
documentation and super ease of use.

they abstract database interface for you,

built-in template system

ready to use admin interface (to manage users) and comment system

at djangoproject.com

Jep, it looks nice, but there are a lot of them for different languages:

ruby (merb, nitro, rails, …)
php (symfony, Akelos, …)
python (django, cherrypy, …)
.
.
http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks

Due the fact that I have not the time and the knowledge to evalute all
of the ;-)), that’s the reason why I ask the experts :wink:

Cheers

Aleks

On Son 20.04.2008 15:38, Cliff W. wrote:

be embedded. I find its syntax much cleaner than Perl and it
undoubtedly has a much smaller memory footprint.

I prefer nekovm (http://www.nekovm.org/) for this :wink:

Look:

http://lists.motion-twin.com/pipermail/neko/2008-April/thread.html

=> NGinx and NekoVM

Cheers

Aleks

On Sun, 2008-04-20 at 23:35 +0200, Aleksandar L. wrote:

MySQL requests (insert/update/delete)
This is OT, but I’d highly recommend PostgreSQL over MySQL for any
application.

Generate HTML-Files with templates => static files
Work with nginx :wink:

I don’t think these aspects will be affected by language choice.

As small as possible mem and cpu usage => efficient interpreter

I personally use Python. I don’t consider Python the “best” language by
any stretch of the imagination (in fact, it’s a really bad language in a
couple key aspects), but it’s a practical language. It’s mature, it
has extensive libraries, the interpreter is rock-solid. There’s several
nice web frameworks to select from. If you care about getting work done
versus doing the coolest thing possible at every moment, you can’t go
wrong with Python.

As far as “light”, I’d consider Python about average in this regard.

Regards,
Cliff

On Son 20.04.2008 15:35, Cliff W. wrote:

On Sun, 2008-04-20 at 23:35 +0200, Aleksandar L. wrote:

The requirements are:

MySQL requests (insert/update/delete)

This is OT, but I’d highly recommend PostgreSQL over MySQL for any
application.

Ok.

As far as “light”, I’d consider Python about average in this regard.
Thanks for your opinion :wink:

Cheers

Aleks

On Mon 21.04.2008 00:26, Manlio P. wrote:

Well, any language will work with Nginx, as long as it has an
HTTP/FastCGI/SCGI server implementation.

Jep :wink:

As for languages embedded inside Nginx, the only choices at the moment
are Python and Perl.

As small as possible mem and cpu usage => efficient interpreter

The memory usage usually depends on the package you use.
The python interpreter in mod_wsgi takes about 3616 KB in the master
process and 1908 KB for each worker.

Thanks for this info :wink:

io seems interesting, I did not knew it.

Jep.

I’m very interested in developing a module for lua (or io), mostly for
testing the best possible integration with the Nginx event module.

Cool, sounds very interesting :wink:

You can test it with Nginx mod_perl and mod_wsgi.
However if the application is IO bound, then the performance are not
the best.

Thanks :wink:

Cheers

Aleks

Manlio,

I would be all over a module for nginx which has the same
functionality as mod_magnet on Lighttpd and I can see already you are
very much into Nginx so I am sure it will be a no brainer for you :slight_smile:

On Sun, Apr 20, 2008 at 6:26 PM, Manlio P.

Ah, http://www.keplerproject.org/

I can suggest you take a look at Kepler Project
(http://kepler-project.org/) which is trying to build a web framework
on top of lua and it works well with fastcgi so it will be no problem
to run it under Nginx. They are almost ready with their 1.0 release
and they took a lot of testing and tweaking to make sure it works on
OS X, Linux and also Windows. I was on their mailing list for quite
some time and these people are persistent :slight_smile: And in the last months
they had so much traffic on the list that I had to unsubscribe. But if
I even need to do anything low memory and fast I would use Lua. The
language is fast and the syntax is very easy to pickup and use.

Kiril

What do YOU think is the ‘best (smallest/fastest/easiest)’ language to
develop a dynamic website?

Well, smallest =/= fastest =/= easiest.

And … picking correct framework or appserver may have greater impact
here than picking the languaga as such.

My current preference for such a tasks is Python, Mako and … any
framework which allows SQLAlchemy :wink:

Regarding nginx support: currently I tend to believe that using
nginx as reverse proxy (and static file server) may be the best
runtime configuration…

On Mon, Apr 21, 2008 at 09:50:58AM +0200, Aleksandar L. wrote:

module. Unlike most dynamic languages, Lua was originally designed to
be embedded. I find its syntax much cleaner than Perl and it
undoubtedly has a much smaller memory footprint.

I prefer nekovm (http://www.nekovm.org/) for this :wink:

Look:

http://lists.motion-twin.com/pipermail/neko/2008-April/thread.html

=> NGinx and NekoVM

It seems that Neko as well as Lua, perl, etc do the same in memory
allocation failure case: exit() or nothing, i.e., segfault.

Igor S. ha scritto:

be embedded. I find its syntax much cleaner than Perl and it
allocation failure case: exit() or nothing, i.e., segfault.

From what I can see, Lua (as Python) throws an exception in case of
memory allocation failure.

Python uses a statically allocated object for the Memory Error
exception.

Lua uses _longjmp/_setjmp, with integer representing error codes.
It only calls exit if no exception handler is installed.

Manlio P.

Igor S. ha scritto:

module.
=> NGinx and NekoVM

Well, but what can I do in exception handler ?
Destroy a whole interpreter, leaving various leaks ?

With Lua you can supply you allocator function.

Manlio P.

On Tue, Apr 22, 2008 at 12:23:26PM +0200, Manlio P. wrote:

module. Unlike most dynamic languages, Lua was originally designed to
It seems that Neko as well as Lua, perl, etc do the same in memory
allocation failure case: exit() or nothing, i.e., segfault.

From what I can see, Lua (as Python) throws an exception in case of
memory allocation failure.

Python uses a statically allocated object for the Memory Error exception.

Lua uses _longjmp/_setjmp, with integer representing error codes.
It only calls exit if no exception handler is installed.

Well, but what can I do in exception handler ?
Destroy a whole interpreter, leaving various leaks ?

Marcin K. ha scritto:

The same for me :wink:
But lately I’m trying to avoid to use the SQLAlchemy ORM.

Regarding nginx support: currently I tend to believe that using
nginx as reverse proxy (and static file server) may be the best
runtime configuration…

The problem with reverse proxy is that you need another server, and this
server is usually written in Python, and most of the time it uses
threads for concurrency, so it’s not the best solution (unless, of
course, you don’t run a whole “cluster” of servers, like Ruby
programmers like to do)

IMHO, a better solution is:

  1. Use Nginx as main server + reverse proxy
  2. Run your application embedded in Apache or
    Nginx (but the application should be written with care)

Manlio P.

On Tue, Apr 22, 2008 at 12:55:17PM +0200, Manlio P. wrote:

for testing the best possible integration with the Nginx event

It only calls exit if no exception handler is installed.

Well, but what can I do in exception handler ?
Destroy a whole interpreter, leaving various leaks ?

With Lua you can supply you allocator function.

It does not resolve the problem. The interpreter internally must test
result of EVERY function that may fail on memory allocations:

void *
interpreter_function0()
{
p = interpreter_function1();
if (p == NULL) {
some rollback operations
return NULL;
}
}

Regarding nginx support: currently I tend to believe that using
nginx as reverse proxy (and static file server) may be the best
runtime configuration…

The problem with reverse proxy is that you need another server,

FastCGI/SCGI/etc are also another server, just less explicit :wink:

and this server is usually written in Python, and most of the time
it uses threads for concurrency,

If you are hardcore, you can use twisted. But IMO it is overkill for
web.

Also, threads are not that bad in such context. Note that here you have
non-trivial code, which makes some database operations, dynamically
formats pages using templates, etc. The cost of some context switches
is far less noticeable than in case of static file serving.

  1. Use Nginx as main server + reverse proxy
  2. Run your application embedded in Apache or
    Nginx (but the application should be written with care)

I do not see any advantages of apache here (unless you want to
use existing permissions, authorization etc infrastructure already
defined for apache).

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs