FreeBSD is billed as a server platform, and I select it for this application, so that's the operating system this is going to run on. As a server platform, setting up an 3-tier application with a web server as the middle level and a database as the back-end server should be painless. I'm happy to report that an afternoon spent setting up the sample application - a dynamically sorted list of links - along those lines was indeed painless.
Three pieces of software need to be selected, and possibly some way to interconnect them. Those are:
The performance of code in the language is not a critical issue - most of the work is going to be parsing HTTP requests, and reformatting database query results into HTML. The performance issue here is that the string-handling facilities be fast. If these are well written, performance may actually exceed hand-coded C or assembler that does things in an obvious way, because the library found a non-obvious but faster solution. This allows much freedom in the language choice.
FreeBSD adds to that, as it has a large selection of languages. The ports tree has 90 subdirectories in its languages directory, though that includes multiple versions and multiple distributions sets of some of the languages. I chose Python because I wanted a dynamic language that was designed with OO features in mind. This example doesn't make particularly good use of those features, but I did want them.
These three parts of the system were trivial to install. As root on the system, the following commands did the trick:
# cd /usr/ports/www/apache13 # make install # cd /usr/ports/databases/postgresql # make install # cd /usr/ports/lang/python # make install
After you've installed the packages, you can start the servers
running by invoking (as root) the shell scripts each installed in the
/usr/local/etc/rc.d:
# /usr/local/etc/rc.d/pgsql.sh # /usr/local/etc/rc.d/apache.sh
The last piece was the connection between Python and the PostGreSQL database, that can also be found in the ports tree. Thanks to FreeBSD's support of shared libraries - and Python's use of them - no changes to any of the previously installed software needs to be made. Just:
# cd /usr/ports/databases/py-PyGreSQL # make install
and everything I needed to build my 3-tier application was installed and ready to use. The next step is to define what the application does.