NIO implementation of the AJP connector

posted by mthomas on June 17, 2011 10:20 AM

The Apache JServ Protocol (AJP) , is a binary protocol that can proxy inbound requests from a webserver, such as Apache HTTPD, to an application server like Apache Tomcat. Typically used in load balanced web applications where the web server has to pass requests to multiple application servers, using modules like mod_proxy_ajp help improve the speed of transactions and add support for SSL. This week’s update of Apache Tomcat 7.0.16, introduces a NIO implementation of the built-in AJP connector.

What is NIO?

New I/O, usually shortened to NIO, is a set of Java APIs that allow for more scaleable I/O operations. Among other things, NIO provides support for non-blocking of data connections which ensures a response from the application server. Without NIO, admins must configure their web servers and application servers to match the number of threads between the web server and application server. Depending on configuration, application behavior and the number of concurrent sessions, there is a constant risk of running out of threads and having users get a HTTP 500 Internal Server error. NIO eliminates this risk by providing a more efficient usage of these threads.

A Simple Example

In simple deployments, users will have one HTTPD instance and one Tomcat server to host their web application. Configure both to use 1000 threads, and the web server instance and the application server instance should run fine. Where it gets complicated is when you employ multiple HTTPDs and multiple instances of Tomcat, and those instances are not using a 1 to 1 mapping— i.e. situations where any HTTPD instance can talk to any Tomcat instance.

Let’s say that you have 2 HTTPD instances and 2 Tomcat instances. Each HTTPD is configured for 1000 threads. Each Tomcat will need to be available to process a connection from each of the threads from all of the instances of HTTPD. So each Tomcat will need 2000 threads. As we add more, this quickly does not scale. As the number of HTTPD instances go up, you need more and more threads on the Tomcat side and eventually this becomes unsustainable.

The NIO Implementation

To avoid running out of threads, admins can work to time out threads, or deploy the Apache MPM Worker to use a pool of threads to reduce the number of connections you will need between HTTPD and Tomcat. Both of these options require significant time and effort to tune the application so it performs well and does not create long running requests or worse, serve up the dreaded 500 Internal Server Error.

The NIO implementation of the AJP connector uses non-blocking I/O on the Tomcat side. So, rather than having one thread per connection, there is a small number of poller threads (normally one or two, and usually under ten) that maintain the connections between Apache HTTPD and Tomcat. Each poller thread can maintain many connections. These poller threads watch for incoming requests from HTTPD and when a request is received , the poller thread passes the request to a worker thread. Once the worker thread completes its task, the worker thread is free to handle another request while the poller thread maintains the connection to httpd. In this scenario, rather than Tomcat having one thread per httpd connection, you can have one thread per concurrent request processed by Tomcat (plus a safety margin) which is often several orders of magnitude lower.

NIO vs APR/Native Connector

Prior to the NIO implementation of the AJP connector, which is pure Java, there was another option for a non-blocking connector through the APR/Native connector. The challenge with the APR/Native implementation is that the code needs to be compiled for every platform. Users need to compile the code for every platform they have throughout their infrastructure. Depending on the size of your architecture, this can get to be an enormous task. Since the NIO implementation is pure Java, there is no need to compile, it just works.

For some deployments, the APR/Native connector may still be worth the extra work of compiling as it does provide better performance for SSL.


In recent years, a reasonable number of SpringSource’s support calls come in about configuring Tomcat and HTTPD to ensure that there are always threads available to serve any given request. This new NIO implementation of AJP provides users with a new option that will simplify configuration, tuning and improve performance for deployments where there are multiple instances of HTTPD as well as multiple instances of Tomcat. This will be particularly true where there are multiple platform types involved as it will simplify the setup of this type of non-blocking connector.

Mark Thomas is a Senior Software Engineer for the SpringSource Division of VMware, Inc. (NYSE: VMW). Mark has been using and developing Tomcat for over six years. He first got involved in the development of Tomcat when he needed better control over the SSL configuration than was available at the time. After fixing that first bug, he started working his way through the remaining Tomcat bugs and is still going. Along the way Mark has become a Tomcat committer and PMC member, volunteered to be the Tomcat 4 & 7 release manager, created the Tomcat security pages, become a member of the ASF and joined the Apache Security Committee. He also helps maintain the ASF's Bugzilla instances. Mark has a MEng in Electronic and Electrical Engineering from the University of Birmingham, United Kingdom.


So the NIO is a more

So the NIO is a more efficient way to manage connections between HTTPD and Tomcat. With it you can work with fewer connections, but it is kind of hard to set up. But it makes it so there’s always threads available to serve a new request.

companies that need IT services


Obat Tradisional Kista Ovarium
Obat Alami Kista Amazon Plus terbuat dari sari kulit buah manggis yang kita tahu banyak manfaatnya. Amazon Plus memiliki zat xanthone yang memiliki super anti oksidan berkali-kali ganda dibandingkan dengan jenis buah lainnya.

Obat Sakit Jantung Bengkak Tradisional
Sakit Jantung Bengkak, menyerang pada jantung itu sendiri. Jantung yang terserang penyakit ini kebanyakan dikarnakan adanya penyumbatan di dalam pembuluh darah pada jantung menyebabkan jantung mengalami pembengkakan, secara tidak normal, menyebabkan kekuatan jantung untuk memompa darah menjadi lemah.
Amazon Minuman Kesehatan adalah jus kulit manggis yang merupakan obat tradisional jantung bengkak yang sangat aman & tidak berbahaya untuk kesehatan organ tubuh lainnya.

Obat Hipertensi Paling Ampuh
Obat Tradisional Darah Tinggi Amazon Plus yang terbuat dari sari kulit manggis, madu serta rosella sangat aman jika diminum dan tidak ada efek samping serta tidak terbuat dari bahan-bahan kimia ataupun pengawet. Dikarenakan dalam kulit manggis itu sendiri sudah terdapat bahan pengawet asli.

easy going

You’ve got some interesting

You’ve got some interesting points in this article. I would have never considered any of these if I didn’t come across this. Thanks!. Free SoundCloud Followers

Thanks for sharing this

Thanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post with people.. certified financial advisor whittier

Game Hack

pixel gun 3d hack Interestingly you write, I will address you'll find exciting and interesting things on similar topics. clash of clans triche

Very awesome!!! When I seek

Very awesome!!! When I seek for this I found this website at the top of all blogs in search engine. wordpress site

Thanks for the wonderful

Thanks for the wonderful post, The content Which you mention in your article ITS really awesome. Its really helpful for everyone. youth prescription sports glasses

I love reading a post that

I love reading a post that will make people think. Also, thank you for allowing me to comment! wordpress designer india

i like your post and all you

i like your post and all you share with us is uptodate and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job. indian generic drugstore online

Good information. Lucky me I

Good information. Lucky me I found your website by accident (stumbleupon). I have bookmarked it for later!
Mortgage Broker Calgary

i am impressed from this

i am impressed from this post....the person who create this post it was a great human.. voyante par telephone

This is my first time i visit

This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, insulation contractors edmonton

I’m excited to uncover this

I’m excited to uncover this page. I need to to thank you for ones time for this particularly fantastic read!! I definitely really liked every part of it and i also have you saved to fav to look at new information in your site. opensyd

I got so involved in this

I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much.Capital One Sign In

great offer

The big advantage of using this binary system is available to get any suggestion when it needs to correct. The is helping the software developers to get connected with each other. Without sharing knowledge and information, it becomes hard to solve the problems.

I was very impressed by this

I was very impressed by this post, this site has always been pleasant news Thank you very much for such an interesting post, and I meet them more often then I visited this site. Cricket SIM unlock code

i read a considerable measure

i read a considerable measure of stuff and i found that the method for composing to clearifing that precisely need to say was great so i am inspired and ilike to come back again in future.. self balancing scooters

I feel happy to read this

I feel happy to read this post. This is the kind of manual that needs to be given at the blogs. Thanks for sharing information on this topic.running health tips

Fantastic blog page with all

Fantastic blog page with all the terrific good items not to mention I’m absolutely sure this will be vastly advantageous. best wireless routers 2017

Thanks for writing such a

Thanks for writing such a good article, I stumbled onto your blog and read a few post. I like your style of writing...voyance par telephone

Articles exhibits the

Articles exhibits the certified virtuoso and viable of one's mind or fitness. is the colossal business site which shows to you how you have to make the best piece out of substance on your composition.

Professional and passionate

Professional and passionate language converters and interpreters are at your ease. check out the link hereFree content directory

This substance is composed

This substance is composed exceptionally well. Your utilization of organizing when mentioning your focuses makes your objective facts clear and straightforward. Much obliged to garcinia cambogia buy

It help me very much to solve

It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy. I think it may be help all of you. Thanks a lot for enjoying this beauty blog with me.slip resistance test


Apache Tomcat is now one of the established brands for it's regular users Memorial Day 2016 in Las Vegas



صور حزينه




صور حزينه


It explains NIO and its

It explains NIO and its implementation by using good example. The article describes the role of Apache JServ protocol in transferring requests from web server to application server. Dissertation writing service reviews opens a platform for web developers to share their knowledge.

Pretty good post. I just

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info reviews.

By freelancing SEO perform

By freelancing SEO perform overseas, SEO organizations can often charge higher quantities in-line with local expenses and then get the task done overseas for a small fraction of the cost use this link.

Mike Craig

Very useful content on very nice website. Great example of perfection.

NIO are mainly used for more

NIO are mainly used for more scalable I/O operations and also for non-blocking of data connections. Implementing NIO is a very difficult task and I don’t know much about this but after reading your article I got a complete idea about this. product photo editing

chalkboard pens

I think that you could do with some pics to drive the message home a bit, but other than that, this is great blog. A great read. chalkboard pens

whiteboard pens

Hey There. I found your blog using msn. This is a very well written article. I’ll be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I’ll definitely return. whiteboard pens

This post helped me to know

This post helped me to know more about NIO which is the set of Java APIs used to allow more scalable I/O operations. The example that you given about NIO implementation helped to understand more about it. Keep sharing cheap wedding planners

vacuum storage bags

This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck. vacuum storage bags

download full hd movies

thanks for sharing this article

latest hollywood movies
download full hd movies
the magnificent seven download full hd movie
rings movie download full hd
download arrival 2016 full hd movie

good night messages

car tracker

Thanks for sharing nice information with us. i like your post and all you share with us is uptodate and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job. car tracker


I really enjoyed reading this post, big fan. Keep up the good work and please tell me when can you publish more articles or where can I read more on the subject? visit


As the part of study read an article about HTTP Connectors. This is a HTTP connector networking wold have more important here.Connector component that communicates with a web connector via the AJP protocol. Get information from Dissertation writing service


I am always searching online for articles that can help me. There is obviously a lot to know about this. I think you made some good points in Features also. Keep working, great job! Source

wild selfies

I'm certainly very happy to read this blog site posts which carries plenty of helpful data, thanks for providing such information. wild selfies

sportagen xt review

Particular interviews furnish firsthand message on mart size, industry trends, ontogeny trends, capitalist landscape and outlook, etc. sportagen xt review

click here to login

This is my first time visit to your blog and I am very interested in the articles that you serve. Provide enough knowledge for me. Thank you for sharing useful and don't forget, keep sharing useful info: click here to login

buy instagram followers

Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. buy instagram followers


Thanks for sharing nice information with us. I like your post and all you share with us is up to date and quite informative, I would like to bookmark the page so I can come here again to read you, as you have done a wonderful job. best lawn mower

ebook download

This is very smart, really an intelligent idea. This is my first time in your blog and I really love it. Thanks for this awesome post. ebook download

I am all that much satisfied

I am all that much satisfied with the substance you have specified. I needed to thank you for this extraordinary article. online marketing


Thanks for a lovely blog Nice

Post new comment

This question is for testing whether you are a human visitor and to prevent automated spam submissions.