AJP13 made easy with mod_proxy

March 18th, 2008 Radim Marek

For a long time mod_jk has been preferred Apache HTTPD plug-in that allowed integration with Tomcat’s JK connectors. It’s certainly perfect solution and still the recommended one for mission critical and highly loaded scenarios.

In case your setup is more relaxed and you looking to do first setup with AJP, there is another solution – mod_proxy. More precisely mod_proxy_ajp that provides ability of handling AJP 1.3 protocol. These modules are enjoying comeback since they have been rewritten for Apache HTTPD 2.2.

Main benefit behind using mod_proxy is the fact that most of the Apache HTTPD installations already come with this module precompiled. Very often not only with HTTP support, but AJP as well. In such a situation administrators feel more tempted to experiment with HTTP based load-balancing scenarios, and therefore more likely to experiment with different protocol.

Let’s have a look how sample configuration would look like:

# Enable Reverse Proxy
ProxyRequests Off

<Proxy balancer://mycluster>
        Order deny,allow
        Allow from all

        # loadfactor = worker load factor
        # route = jvmRoute appended to SESSIONID, reflecting setting in server.xml
        # min = minimum number of connections to backend server
        # max = maximum number of connections to backend server
        BalancerMember ajp://192.168.10.33:8009/ loadfactor=10 route=33 min=10 max=50 keepalive=On
        BalancerMember ajp://192.168.10.34:8009/ loadfactor=2 route=34 min=10 max=50 keepalive=On
</Proxy>

ProxyPass /proxy balancer://mycluster STICKYSESSION=JSESSIONID|jsessionid nofailover=On
ProxyPassReverse /proxy balancer://mycluster
ProxyPassReverseCookieDomain backend.server public.server

In this case two nodes are created to participate in load-balancer using AJP as connector to backend Tomcat; session affinity enabled with STICKSESSION configuration.

Overall the configuration corresponds with the one you would normally create using mod_jk. Now you’re probably asking what’s the catch. And answer is simple – you loosing dynamic options (periodic reload of mapping), only simplified balancing features and generally the performance is slightly behind mod_jk. My tests during last few months (both with experimental and production grade setups) show difference approximately about 6 – 7% drop down. Something not really worrying if you’re running medium sized intranet solution and you already need clustered solution, or if you just discovering world of load balancing.

For more information, please, check following resources:

Posted in Administration, jboss | 1 Comment »

JBoss for Administrators

March 16th, 2008 Radim Marek

Training designed to help System Engineers to acquire necessary knowledge to understand requirements, master installation, deployment and management of JBoss Application server. Throughout the course delegates are getting exposed to the terminology used in Java EE development, understand architecture of application server and learn how to change configuration to suite particular needs – and most importantly delivery stable and secure instance for production environment.

It’s a 3-day course with following agenda:

Day 1

  • Installing and deployment of JBoss Application Server
  • JBoss Services configuration

Day 2

  • JBoss production configuration
  • Connector Tuning
  • Securing JBoss Application Server

Day 3

  • Clustering on JBoss Application Server
  • Best Practices in JBoss Performance Tuning
  • JBoss Operation Network training

Requirements: no prior knowledge of Java EE development necessary, working knowledge of Windows or UNIX based systems; able to install and use Java to run applications.

Pre-course reading materials:

Post-course reading materials:

Course content

JBoss Application Server Architecture covers necessary basics what is an application server and it’s role in infrastructure. Basic Java EE terminology is covered and practically presented using Travel Reservation application example.

Core concepts is chapter covering basics of the technologies used in JBoss AS, including JMX (Java Management Extensions) – the way how it’s used in design of application server microkernel, interceptors, invokers and dynamic proxies.

JBoss installation will provide delegates first stand-alone JBoss instance with default or customized server configuration. Focus is targeted on how to choose right version of JBoss AS and Java Virtual Machine, what are the hardware and operating system requirements. Hands-on lab is focusing on installation and verification if it’s working properly.

Deploying applications will provide information about various packages provided by Java EE or JBoss and how to [re/un] deploy them both for application and services. Delegates will be introduced to concept of class files and class loader. Hands-on lab on deployment is there to verify newly acquired knowledge.

JBoss Service Configuration is comprehensive part of the course covering important services of JBoss AS like JBossWeb (Tomcat), Naming Service, EJB Invokers, JMS provider, scheduler, etc. The rationale behind it is to provide understand about multiple components that are forming together application server and how they’re significant from administrator’s point of view. By end of this part participants will have overview about numerous open ports they need to secure or configure. Cheat sheet with the list of opened ports is provided.

Hands-on session is available to practice scheduler service using real-life scenarios.

JBoss production deployment focuses on getting instances of the application server into production environment. Topics include understanding of JDBC, way how to configure datasources, deployment ordering to suite different needs, both if it’s standalone installation or part of the cluster. To help create easily separated environments, delegate will learn how to run multiple instances of JBoss on the same host.

Hands-on sessions include practice deployment ordering and setting up multiple nodes.

JBoss Tuning covers optimum configuration both of the front-end (JBossWeb) to handle incoming HTTP requests effectively and back-end, including datasources. Second of the lesson is dedicated to in-depth introduction of the garbage collection and how to configure it. Different methods how to monitor JVM, application server and services will be demonstrated.

Introduction to Java EE and JBoss Security describes differences between authentication, authorization and encryption, including the way in which the Java EE security model is configured inside JBoss. Close down instructions are included for the necessary services. Practical hands-on session focuses on securing JMX console both using username/password and SSL certificate.

JBoss Clustering introduces terminology, challenges and techniques required to achieve high available solutions. JGroups, as the clustering building block, is introduced and extensive troubleshooting methods are discussed. Consequent clustering configuration for services and components participating in high available environment is demonstrated using simply to use instructions.

Mod_jk as the load balancing solution for JBossWeb (Tomcat) is introduced, covering architecture and configuration options. Delegates should become confident using it during hands-on session.

JBoss Operation Network Training provides overview about the monitoring and administering JBoss middleware using the JON (JBoss Operation Network).

Recommendation

The JBoss for Administrator is focusing on information for System Engineers. It might be useful for developers - especially in small teams - but they might feel the training is not going to necessary details where related to development. If this training is part of private course or there is time during public course, the clustering part can be easily extended to provide necessary information to understand this topic in necessary depth. JBoss Clustering training might be on other side overwhelming for administrators as it’s been designed primary for senior developers and architects.

About

This blog post is part of my series focusing on the JBoss training as offered by RedHat.

For more information, please, visit the original post.

Link:

Posted in Administration, jboss, training | No Comments »

JBoss Training

March 16th, 2008 Radim Marek

Looking for JBoss training? This series is here to help you where to start and to decide which one is the right for you. In-depth description of individual courses, list of hands-on exercises and additional support materials are compiled to improve your experience.

List of currently available courses follows. If the link is missing (and only official information is available) I’m still working on it, and hopefully it will be available soon.

Application platform Courses

Enterprise Platform Courses

More information and training sales

If you need further help regarding available public courses or looking for private customized training, please, don’t hesitate to contact me. Currently I work for Business System Group in London (UK), member of JBoss Certified Partner program and authorized Training partner. My job description includes responsibility for delivery of selected JBoss courses.

Information provided about JBoss courses on this website does not necessarily correspond with the official information provided by RedHat, or by my employer – Business System Group.

Posted in jboss, training | No Comments »

Aggregation vs Composition

March 10th, 2008 Radim Marek

Not just while using UML, but in general object design discussions I’m often facing situation when somebody doesn’t really understand different ways how to design new objects. This blog post is my attempt to summarize the differences between aggregation and composition, and provide examples accompanied by UML diagrams. 

Answer for this confusion is in ownership. When composition is used the destruction of the object will result in destruction of it’s contained objects. When aggregation is used, this is not necessarily the case.As far as it’s only Java code concern, there is no difference what method you will use.

The significance of the need to distinguish them starts with introduction of mapping Java classes into other environments. Easiest example could be Hibernate mapping. Following POJO is not providing any information if aggregation or composition is used for homeAddress or department:

	class Employee {
		private Long id;
		private String name;
		private Department department;
		// …
		private NextOfKin nextOfKin;
		// …
	}

In this example department is obviously independent of the Employee class life cycle and therefore it’s aggregation, as the department will be there even when Employee record is not longer necessary. On other side it’s very unlikely nextOfKin will be referenced by any other component of the domain model, so it’s composition.Database design then could look like this:

Notice that department is referenced using foreign key, whereas next of kin is just component created using multiple columns from this table.When visualized using UML, only thing you have to remember is different in diamond representing association. Black diamond represent composition and white diamon aggregation. Example follows:

Hope this example will help.

Posted in design | No Comments »