In a recent post, the twitter development annnounced that a variety of
tools are now packages on
scala-tools.org. Ostrich was one of those
tools.
If you are interested in integrating Ostrich into your lift app, you
can take a look at Apache ESME where we just implemented it.
Ostrich (
http://github.com/robey/ostrich) is a small library for
collecting and reporting runtime statistics from a scala server and
originates from the Twitter development team. It can collect counters,
gauges, and timings, and it can report them via JMX, a simple web
interface (JSON), a plain-text socket, or a "W3C" log file. A server
can also be asked to shutdown or reload its config files using these
interfaces.
Here is the current output from ESME:
$ curl
http://localhost:9990/stats
{"counters":{"userCount":1,"liftSessions":1},"timings":{},"jvm":
{"nonheap_commit;ted
":52723712,"heap_max":259522560,"thread_peak_count":
56,"heap_committed":25702
400,"uptime":204782,"nonheap_max":123731968,"thread_daemon_count":
35,"num_cpus":
2,"thread_count":55,"nonheap_used":42131152,"start_time":
1275742241593,"heap_use
d":17745008},"gauges":{"users":1.0,"listener":1.0}}
Since this info is available via JSON - you should be able to easily
create a web tool that graphically displays the stats from your lift
application. This functionality is important for productive usage in
that you can track not only java-related metrics but also your
application-specific measures.
Unfortunately, it doesn't work on Stax, because currently only one
port (80) is available in this environment and you can't have Lift and
ostrich listening to same port.
The patch was supplied by Imtiaz Ahmed Hajee Esmail and the patch URL
is here:
http://svn.apache.org/viewvc?view=revision&revision=952273
D.
Co-Project Lead / Apache ESME
http://cwiki.apache.org/confluence/display/ESME/Index