my recommendation is to get an in depth understanding
about the application specific performance implications of
- the general performance characteristics (per-query response time,
variance, degree of concurrency, throughput),
- the application bottlenecks (database queries, database locks,
mutex locks, computational expensive computations, calls to
external services) and the
- server environment and configuration (ranging from e.g.
the linux file system to the web server configuration).
Recoding in C is just one option (which might be or might not be
the right option for the best performance gain per invested effort).
When the connection requests can be executed with no
or little locks, the throughput can be improved nearly linearily
on multi-core machines to a level determined by the number
of available cores provided that neither i/o or the database
are the bottleneck.
If one needs to improve the per-request performance,
from my experience, "modernizing" the Tcl code can lead
already to substantial improvements (make sure to use
constructs which are byte-compiled, brace expressions, use
recent Tcl idioms such as the expand operator). Another
important source for improving throughput is to exploit
spooling rather than using blocking connection threads.
On OpenACS.org such changes lead to a performance increase
with moderate effort by a factor of 5 or 6
http://openacs.org/forums/message-view?message_id=4074774
Tcl can be quite efficent on string operations, but it certainly
depends on
your application and on your expectations (if your requests are
already
in the 1 digit ms range, going to C might be the way to go). Often,
performance is lost at places, where one does not look first, such
as times spent on request setup (e.g. filters), templating, etc.
NaviServer provides some means for better understanding
where the time is spent by providing e.g. partial response times
or per-thread cpu timings etc. which can be used for monitoring
via tools like munin or for ex-post analysis from the access log.
best regards
-gustaf
PS: in terms of scalability nsv are sometimes not the best
choice, since the access to nsvs requires locks, and getting
all keys of a large array can lead to long lock times. On low
traffic sites (< 100.000 page views/day) that is probably not an
issue. so it really depends on your site characteristics and
type of application...