Help to boost the performance of my proxy server

Out of my personal interest, I am developing a proxy server in java for enterprises.

I've made the design as such the user's request would be given to the server through the proxy software and the response would hit the user's browsers through the proxy server.

User - > Proxy software - > Server

Server -> Proxy software -> User

I've designed the software in java and it is working

fine with HTTP and HTTPS requests.The problem which i am so scared is,

for each user request i am creating a thread to serve. So concurrently if 10000 users access the proxy server in same time,

I fear my proxy server would be bloated by consuming all the resources in the machine where the proxy software is installed.This is because,i'm using threads for serving the request and response.

Is there any alternative solution for this in java?

Somebody insisted me to use Java NIO.I'm confused.I need a solution

for making my proxy server out of performance issue.I want my

proxy server would be the first proxy server which is entirely

written in java and having a good performace which suits well for

even large organisations(Like sun java web proxy server which has been written in C).

How could i boost the performace?.I want the users should have no expereience of accessing the remote server through proxy.It would be like accessing the web server without a proxy for them.There should be not performance lagging.As fast as 'C Language'.I need to do this in java.Please help.

[1581 byte] By [Sreenivasan_Narayanana] at [2007-11-26 18:03:34]
# 1
> Somebody insisted me to use Java NIO.I'm confused.What's confusing about that suggestion? It's a very good one.BTW you are already too late for the title of first proxy server written in Java, by at least seven years.
ejpa at 2007-7-9 5:33:46 > top of Java-index,Java Essentials,Java Programming...
# 2
Hi Using NIO will make my server works with TOP performance?.Is NIO a replacement to thread?.
Sreenivasan_Narayanana at 2007-7-9 5:33:46 > top of Java-index,Java Essentials,Java Programming...
# 3
Yes.No.
ejpa at 2007-7-9 5:33:46 > top of Java-index,Java Essentials,Java Programming...
# 4
NIO just stands for New I/O. It's a more optimised approach to I/O than the old stuff. Look at the java.nio package in the JDK and google some tutorials.I think having a thread per request is fine. You might want to pool your threads though and make the size
ted_trippina at 2007-7-9 5:33:46 > top of Java-index,Java Essentials,Java Programming...
# 5
> I think having a thread per request is fine.Maybe I got it wrong, but I thought the point in using NIO with sockets was to get rid of the 1 thread per request combo?
quittea at 2007-7-9 5:33:46 > top of Java-index,Java Essentials,Java Programming...
# 6
Read here about non blocking IO. http://www-128.ibm.com/developerworks/java/library/j-javaio/And you can find an example here: http://www.cafeaulait.org/slides/javapolis/toptenmyths/14.html
Rodney_McKaya at 2007-7-9 5:33:46 > top of Java-index,Java Essentials,Java Programming...
# 7

> > I think having a thread per request is fine.

>

> Maybe I got it wrong, but I thought the point in

> using NIO with sockets was to get rid of the 1 thread

> per request combo?

Correct. A server which has one thread per client doesn't scale well.

Kaj

kajbja at 2007-7-9 5:33:46 > top of Java-index,Java Essentials,Java Programming...