Setting up workers.properties file for mod_jk

ajpapache-2.2glassfishmod-jk

I'm trying to create a workers.properties file to get mod_jk communicating with Apache webserver 2.2.x. The GlassFish 3.1 Administration Document includes the following example for worker.properties:

# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
# GlassFish server settings
maxThreads=256

Does this example assume that mod_jk/Glassfish is installed in a different physical server than Apache webserver? More specifically, if in my situation, where Apache webserver and Glassfish and mod_jk are all on the same physical server, do I need to specify the port number (e.g. 8009)?

That is, I thought the concept of ports was to facilitate machine-to-machine communication. If everything's on the same machine, do they even need a port number open to communicate? Or, is port 8009 needed for some other reason? In my situation, I'd like to use Apache webserver as front-end for Glassfish, so Glassfish doesn't directly talk to external clients.

So the main question here is how to adapt the above example file for the case where everything is installed on the same server, and Glassfish used mod_jk as simple pass-through from Apache webserver?

A second question would be, what is the maximum number of maxThreads one can set? (Is this limited by AJP13 protocol, or something else?)

Best Answer

You have a couple of questions here, i'll try and answer them in order.

That is, I thought the concept of ports was to facilitate machine-to-machine communication. If everything's on the same machine, do they even need a port number open to communicate?

Yes, and no. What ports are used for is to allow multiple IP based services talk to each other. It doesn't necessarily mean it's computer to computer. It only really means you are talking to an IP based service.

So the main question here is how to adapt the above example file for the case where everything is installed on the same server, and Glassfish used mod_jk as simple pass-through from Apache webserver?

The example is correct, you still need to specify the ajp port, otherwise mod_jk will not be able to connect to the instance. Even thought it's on the same machine you are still making an IP socket connection - it's just via the loop back adapter and not an standard adapter like eth0

A second question would be, what is the maximum number of maxThreads one can set? (Is this limited by AJP13 protocol, or something else?)

I think it's just an INT - but i would strongly suggest NOT setting this to the highest settings - start somewhere 256 is a good starting place and monitor what is happening with your app and how many connections it really needs.