caucho
Resin
FAQ
Reference Guide
Demo
Tutorial

JSP page
Config
URLs
Database Forms
XTP Copy
Hello Tag
Vary Filter
HardCore
Mailing Forms
Beans
Cache
XSL Filter
run-at
jndi app config
 Resin HardCoretm

Vary Filter
Tutorial
Mailing Forms

  1. Basic Operation
  2. Installation
  3. Configuration in /proc/net/resin
  4. Caveats and Errata

Note: Resin HardCore is experimental.

Resin HardCore is a Linux kernel module. By pulling the webserver into the kernel single-computer Resin servers and load-balanced servers can greatly improve their performance. HardCore replaces Apache as a web-server, grabbing HTTP requests and passing them to the backend Resin JVMs. Because HardCore operates entirely in the kernel, it has very low overhead.

Basic Operation

Resin HardCore works much like the Apache/mod_caucho combination. When a new browser request appears on port 80, it accepts the request and parses the HTTP header. It then selects a JVM and forwards the request to the backend servlet runner. When the servlet runner responds, HardCore will send the response to the browser.

Unlike Apache/mod_caucho, HardCore passes every request to the servlet runner. In essence, it's a kernel proxy. Restricting HardCore to a proxy tremendously simplifies the configuration and maintenance -- an important consideration when writing a kernel application.

Because HardCore is entirely in kernel space, it can quickly forward the requests without slow context switches or copying from user space. Once the load-balancing is complete, an Linux box can serve as a low cost sticky-session load balancer with much better performance than an Apache load balancer.

Installation

The Resin ./configure script will select the Linux sources. The standard make; make install will put a resin.o in resin-2.0.x/libexec. resin.o is the actual kernel module.

For standard configurations, ./configure will find the source, but you can change it with configure arguments (or in the Makefile).

--with-linux-src=/usr/src/linuxSelects the kernel source
--enable-linux-smpCompiles for an SMP system or not.

Once you've got a resin.o in libexec, you can install it as a module. The Linux command is insmod.

HardCore can take an optional argument, port, to select the server port. It defaults to the standard HTTP port 80.

unix> ./configure --with-linux-src=/usr/src/linux
...
unix> make
unix> make install
unix> su root
unix# /sbin/insmod libexec/resin.o port=81

...

unix# /sbin/rmmod resin

Configuration in /proc/net/resin

Once as a module, HardCore creates the /proc/net/resin directory for configuration. It currently contains three files: server_port to configure the listening port, srun-count to specify the number of load balancing servlet-runners, and srun-n to configure each servlet runner.

server_portConfigures the listening port, e.g. 80 (currently read-only)
srun-countConfigures how many servlet runners to use
srun-0The IP and port for the first servlet runner

You can look at those files to see their values:

unix# ls /proc/net/resin
server_port srun-0 srun-count
unix# cat /proc/net/resin/server_port
80
unix# cat /proc/net/resin/srun-count
1
unix# cat /proc/net/resin/srun-0
127.0.0.1 6802

You can also configure srun-0 to change the servlet runner.

unix# echo "192.168.0.3 6810" > /proc/net/resin-srun-0

Caveats and Errata

Any bugs in HardCore will likely crash or freeze your computer. In theory it could also do bad things to the filesystem, although that hasn't happened to us ... yet. Working with kernel modules is not as safe as a C program and nowhere near as safe as running a Java program.

The 12/21 version handles basic GET requests.

The current errata:

  • POST requests are not handled
  • Date routines have not yet been implemented
  • Load-balancing is not yet done
  • Failure to contact a srun results in a disconnect instead of an error message.
  • /caucho-status isn't implemented yet.
  • Caching isn't implemented yet.
  • Logging isn't implemented yet.
  • HTTP/1.1 keepalive isn't implemented.

Vary Filter
Tutorial
Mailing Forms
Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.