Re: JIO Connector support in Tomcat 8.5

2017-02-20 Thread Amit Pande
Thanks Chris. We are indeed evaluating if we can leverage traditional 
reverse-proxy based solutions.

However, continued our POC for the custom NIO endpoint. We extended the 
NioEndpoint of Tomcat 8.5.x and overrode the following methods:

1. Bind
2. Unbind
3. UnlockAccept
4. Acceptor 

Intend to use most of the NIO code for poller threads and other start stop 
logic. One issue faced was that “stopLatch” is not accessible outside the 
NioEndpoint class. This stopLatch is initialized during “bind” and used during 
“stop”. But since we override bind and don’t have access to “stopLatch”we’re 
facing issues while using the default NioEndpoint implementation.

Could an enhancement request be filed to make this field protected similar to 
other fields such as pollerThreadCount, acceptorThreadCount?

Reflection seems too hack-ish and don’t see any issues with making this field 
protected instead of private.

Appreciate your thoughts.

Thanks,
Amit

On 2/16/17, 11:48 AM, "Christopher Schultz"  
wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Amit,

On 2/13/17 8:19 PM, Amit Pande wrote:
> Thanks for a quick reply.
> 
> What does our custom connector do?
> 
> Well, we have a server program which is listening on a port which
> is mandatory to be open/accessible for the outside world. Outside
> world only talks to this component which in turn hands off (dup
> system call) the socket to the other processes. Tomcat being one
> such process.
> 
> Our custom connector accepts the handed-off socket and then
> resumes the normal processing done by Tomcat.

Why not use a more traditional reverse-proxy, which already knows how
to handle these kinds of protocols?

> Now for NIO connector, seems we need to have a custom
> implementation of the SocketChannel but not sure how it might
> work.

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYpeXnAAoJEBzwKT+lPKRY7bQQAKCiCfsy0HZLqRn3qY42IU3E
Ab49WJTzbblJJAUF+ryn9jrjEOP/3m/a69r+2qotL2bv5L9qY1TBqNjyNgAzQ3b/
v/WAlDmzV51UUc6vG/1GcHgExgUMAHTLwQ0tvUIBAdcrMiX6EPE3J4/G0Q9T0eSb
n6ap/WyL0AAPHrx13/xWQeVd1BByrqLiv6DA3+5VbbqewxBbGLUgL1gy/6DNSnCs
lyTlTOqAnW8vN6vEpHW+7lDYgO1vgRwcfN2aZUzWFf8CSgHKhaG+zVOGWv67pbUy
sZVmGpgc/v3Xny/sCrKxPTN2LeRIJRbkxffcgSThAmfCCKqswcpKK0XDAhwgVq5+
EXuz0DQ7LC5e85iIo38wZD7OSft5lf0Gp5UViLzys5WVBkaxdI7Gx/0HPPMJA4d3
681FilJm3hbd7ngXLX7is5ptnfIKgXgSrWotYjzZMTDHaWX6jvn8ygptXzOXHnJk
Dz29gSUJ7Ciuxv39IS8vWNaZYmNx73nc3bCO+xRjoBzOzylznAw1wtzdH+kXvayY
VINusuGur5NlyHERm4/NMQy+T0JSLYvMysEB5UWsUJR4LiAYAMPkNbgiG2sAW7MX
EJwHQSPCySukb9ileiBI39HzX16cGpIn3RUpiCKzdBpRzKUtmXge5/48WeqCY5UG
M7WwfZGBqtPeJUqfOybg
=eMgR
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: JIO Connector support in Tomcat 8.5

2017-02-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Amit,

On 2/13/17 8:19 PM, Amit Pande wrote:
> Thanks for a quick reply.
> 
> What does our custom connector do?
> 
> Well, we have a server program which is listening on a port which
> is mandatory to be open/accessible for the outside world. Outside
> world only talks to this component which in turn hands off (dup
> system call) the socket to the other processes. Tomcat being one
> such process.
> 
> Our custom connector accepts the handed-off socket and then
> resumes the normal processing done by Tomcat.

Why not use a more traditional reverse-proxy, which already knows how
to handle these kinds of protocols?

> Now for NIO connector, seems we need to have a custom
> implementation of the SocketChannel but not sure how it might
> work.

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYpeXnAAoJEBzwKT+lPKRY7bQQAKCiCfsy0HZLqRn3qY42IU3E
Ab49WJTzbblJJAUF+ryn9jrjEOP/3m/a69r+2qotL2bv5L9qY1TBqNjyNgAzQ3b/
v/WAlDmzV51UUc6vG/1GcHgExgUMAHTLwQ0tvUIBAdcrMiX6EPE3J4/G0Q9T0eSb
n6ap/WyL0AAPHrx13/xWQeVd1BByrqLiv6DA3+5VbbqewxBbGLUgL1gy/6DNSnCs
lyTlTOqAnW8vN6vEpHW+7lDYgO1vgRwcfN2aZUzWFf8CSgHKhaG+zVOGWv67pbUy
sZVmGpgc/v3Xny/sCrKxPTN2LeRIJRbkxffcgSThAmfCCKqswcpKK0XDAhwgVq5+
EXuz0DQ7LC5e85iIo38wZD7OSft5lf0Gp5UViLzys5WVBkaxdI7Gx/0HPPMJA4d3
681FilJm3hbd7ngXLX7is5ptnfIKgXgSrWotYjzZMTDHaWX6jvn8ygptXzOXHnJk
Dz29gSUJ7Ciuxv39IS8vWNaZYmNx73nc3bCO+xRjoBzOzylznAw1wtzdH+kXvayY
VINusuGur5NlyHERm4/NMQy+T0JSLYvMysEB5UWsUJR4LiAYAMPkNbgiG2sAW7MX
EJwHQSPCySukb9ileiBI39HzX16cGpIn3RUpiCKzdBpRzKUtmXge5/48WeqCY5UG
M7WwfZGBqtPeJUqfOybg
=eMgR
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: JIO Connector support in Tomcat 8.5

2017-02-14 Thread Amit Pande
Any suggestions on this?

Could the Tomcat NIO connector be modified to receive the file descriptor from 
the other process ( mentioned below)?

Thanks,

Amit

 Original Message 

Subject: Re: JIO Connector support in Tomcat 8.5

From: Amit Pande <amit.pa...@veritas.com>

Date: Feb 13, 2017, 19:20

To: Tomcat Users List <users@tomcat.apache.org>

Thanks for a quick reply.

What does our custom connector do?

Well, we have a server program which is listening on a port which is mandatory 
to be open/accessible for the outside world. Outside world only talks to this 
component which in turn hands off (dup system call) the socket to the other 
processes. Tomcat being one such process.

Our custom connector accepts the handed-off socket and then resumes the normal 
processing done by Tomcat.

Now for NIO connector, seems we need to have a custom implementation of the 
SocketChannel but not sure how it might work.

Thanks,

Amit

 Original Message ----

Subject: Re: JIO Connector support in Tomcat 8.5

From: Christopher Schultz <ch...@christopherschultz.net>

Date: Feb 13, 2017, 18:58

To: Tomcat Users List <users@tomcat.apache.org>

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Amit,

On 2/13/17 6:55 PM, Amit Pande wrote:
> As I understand, the JIO/BIO connector support has been dropped in
> Tomcat 8.5 +.

Correct.

> While I understand the need to push to the NIO based connectors,
> just wondering whether the JIO connector support could have been
> left as it in Tomcat 8.5 and beyond.

No.

> We had extended the BIO connector to have a custom implementation
> and that is broken now once we move to latest Tomcat versions.

You will have to figure something out.

Why did you need to create your own connector?

> We're evaluating refactoring our custom connector but would
> appreciate if there are any suggestions to get the BIO
> implementation going even in 8.5 and beyond so that our custom
> connector's functionality isn't regressed.

BIO is problematic because of many requirements for non-blocking
behavior. It's easy to emulate blocking behavior (e.g.
ServletRequest.getInputStream) based upon non-blocking building blocks
(e.g. NIO connector) but next to impossible to emulate non-blocking
behavior (websocket, comet, etc.) using blocking building blocks (BIO
connector).

Unfortunately, the reality is that a blocking I/O connector is no
longer feasible for Tomcat.

So... what does your custom connector do? Perhaps there's a better way
to achieve your goal, or perhaps Tomcat's connectors could be
re-factored to make it easier to customize something specific for you
without having to re-write the whole connector.

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYolY6AAoJEBzwKT+lPKRYpCEQALefIMml43cS3r254mGE/pFS
+QWDnaPG2t96oXM8GExUWm6jGBCGarxt7FBxxku112DS8+5NzkmEmP8BdkAkOIeN
7p/1jiGhZ4Koz7ER4JUzAXbbSFmJBjOXWfxYPzecZHrBBdfndoBx2PWRe/Ew4LNY
ujJLSwZWuUSlZu1CBzPT/UU0klthqRRsfHH8JrHe64Jm+qZuPIITjr0G15IYSEU3
SihVCFMmA//yQfRb8rNN9UCM8lYYtu4oYwiythPNt30wz0e5XzOemyX+f/MMlFyD
yWrKlOI9x+g9OVoMNSYvsq+9EO/TTzTW6mWtW26rnHskEz0i/98QIVqg9XIRIvrM
3mPq6Ufuq6Aq75WIVtJcKUe4voDu9KSmOHb7AKsLPFrB6WbzDluSSWD3VpxM/q5R
gluvGG9CcCIRl1ie1ljg3qO90ZPno38RuQl+vxKSsGlY5t/mSce1M4ffBgJdg/T7
GpKZ/+GYTUuDg/jE+9pav/yO2mx8Hj/Oo6TvGCACT4o+sRXtceORcq93c8npCT0L
4+jvS2aJT0Gud3jn2gZ9qZnXGdFWdq59LTnZ1/s6p9gGHglCtWBx9j3fMkS53y1y
41giiY9GXKuEzyHUlSaTT3rLucJCzcJWvHi/k1muqclUn5/Ht2NVHXoLmxVPxgzL
K0bIRYJ9K2R/ou+6YPiV
=zu1M
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: JIO Connector support in Tomcat 8.5

2017-02-13 Thread Amit Pande
Thanks for a quick reply.

What does our custom connector do?

Well, we have a server program which is listening on a port which is mandatory 
to be open/accessible for the outside world. Outside world only talks to this 
component which in turn hands off (dup system call) the socket to the other 
processes. Tomcat being one such process.

Our custom connector accepts the handed-off socket and then resumes the normal 
processing done by Tomcat.

Now for NIO connector, seems we need to have a custom implementation of the 
SocketChannel but not sure how it might work.

Thanks,

Amit

 Original Message 

Subject: Re: JIO Connector support in Tomcat 8.5

From: Christopher Schultz <ch...@christopherschultz.net>

Date: Feb 13, 2017, 18:58

To: Tomcat Users List <users@tomcat.apache.org>

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Amit,

On 2/13/17 6:55 PM, Amit Pande wrote:
> As I understand, the JIO/BIO connector support has been dropped in
> Tomcat 8.5 +.

Correct.

> While I understand the need to push to the NIO based connectors,
> just wondering whether the JIO connector support could have been
> left as it in Tomcat 8.5 and beyond.

No.

> We had extended the BIO connector to have a custom implementation
> and that is broken now once we move to latest Tomcat versions.

You will have to figure something out.

Why did you need to create your own connector?

> We're evaluating refactoring our custom connector but would
> appreciate if there are any suggestions to get the BIO
> implementation going even in 8.5 and beyond so that our custom
> connector's functionality isn't regressed.

BIO is problematic because of many requirements for non-blocking
behavior. It's easy to emulate blocking behavior (e.g.
ServletRequest.getInputStream) based upon non-blocking building blocks
(e.g. NIO connector) but next to impossible to emulate non-blocking
behavior (websocket, comet, etc.) using blocking building blocks (BIO
connector).

Unfortunately, the reality is that a blocking I/O connector is no
longer feasible for Tomcat.

So... what does your custom connector do? Perhaps there's a better way
to achieve your goal, or perhaps Tomcat's connectors could be
re-factored to make it easier to customize something specific for you
without having to re-write the whole connector.

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYolY6AAoJEBzwKT+lPKRYpCEQALefIMml43cS3r254mGE/pFS
+QWDnaPG2t96oXM8GExUWm6jGBCGarxt7FBxxku112DS8+5NzkmEmP8BdkAkOIeN
7p/1jiGhZ4Koz7ER4JUzAXbbSFmJBjOXWfxYPzecZHrBBdfndoBx2PWRe/Ew4LNY
ujJLSwZWuUSlZu1CBzPT/UU0klthqRRsfHH8JrHe64Jm+qZuPIITjr0G15IYSEU3
SihVCFMmA//yQfRb8rNN9UCM8lYYtu4oYwiythPNt30wz0e5XzOemyX+f/MMlFyD
yWrKlOI9x+g9OVoMNSYvsq+9EO/TTzTW6mWtW26rnHskEz0i/98QIVqg9XIRIvrM
3mPq6Ufuq6Aq75WIVtJcKUe4voDu9KSmOHb7AKsLPFrB6WbzDluSSWD3VpxM/q5R
gluvGG9CcCIRl1ie1ljg3qO90ZPno38RuQl+vxKSsGlY5t/mSce1M4ffBgJdg/T7
GpKZ/+GYTUuDg/jE+9pav/yO2mx8Hj/Oo6TvGCACT4o+sRXtceORcq93c8npCT0L
4+jvS2aJT0Gud3jn2gZ9qZnXGdFWdq59LTnZ1/s6p9gGHglCtWBx9j3fMkS53y1y
41giiY9GXKuEzyHUlSaTT3rLucJCzcJWvHi/k1muqclUn5/Ht2NVHXoLmxVPxgzL
K0bIRYJ9K2R/ou+6YPiV
=zu1M
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: JIO Connector support in Tomcat 8.5

2017-02-13 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Amit,

On 2/13/17 6:55 PM, Amit Pande wrote:
> As I understand, the JIO/BIO connector support has been dropped in 
> Tomcat 8.5 +.

Correct.

> While I understand the need to push to the NIO based connectors,
> just wondering whether the JIO connector support could have been
> left as it in Tomcat 8.5 and beyond.

No.

> We had extended the BIO connector to have a custom implementation 
> and that is broken now once we move to latest Tomcat versions.

You will have to figure something out.

Why did you need to create your own connector?

> We're evaluating refactoring our custom connector but would 
> appreciate if there are any suggestions to get the BIO
> implementation going even in 8.5 and beyond so that our custom
> connector's functionality isn't regressed.

BIO is problematic because of many requirements for non-blocking
behavior. It's easy to emulate blocking behavior (e.g.
ServletRequest.getInputStream) based upon non-blocking building blocks
(e.g. NIO connector) but next to impossible to emulate non-blocking
behavior (websocket, comet, etc.) using blocking building blocks (BIO
connector).

Unfortunately, the reality is that a blocking I/O connector is no
longer feasible for Tomcat.

So... what does your custom connector do? Perhaps there's a better way
to achieve your goal, or perhaps Tomcat's connectors could be
re-factored to make it easier to customize something specific for you
without having to re-write the whole connector.

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYolY6AAoJEBzwKT+lPKRYpCEQALefIMml43cS3r254mGE/pFS
+QWDnaPG2t96oXM8GExUWm6jGBCGarxt7FBxxku112DS8+5NzkmEmP8BdkAkOIeN
7p/1jiGhZ4Koz7ER4JUzAXbbSFmJBjOXWfxYPzecZHrBBdfndoBx2PWRe/Ew4LNY
ujJLSwZWuUSlZu1CBzPT/UU0klthqRRsfHH8JrHe64Jm+qZuPIITjr0G15IYSEU3
SihVCFMmA//yQfRb8rNN9UCM8lYYtu4oYwiythPNt30wz0e5XzOemyX+f/MMlFyD
yWrKlOI9x+g9OVoMNSYvsq+9EO/TTzTW6mWtW26rnHskEz0i/98QIVqg9XIRIvrM
3mPq6Ufuq6Aq75WIVtJcKUe4voDu9KSmOHb7AKsLPFrB6WbzDluSSWD3VpxM/q5R
gluvGG9CcCIRl1ie1ljg3qO90ZPno38RuQl+vxKSsGlY5t/mSce1M4ffBgJdg/T7
GpKZ/+GYTUuDg/jE+9pav/yO2mx8Hj/Oo6TvGCACT4o+sRXtceORcq93c8npCT0L
4+jvS2aJT0Gud3jn2gZ9qZnXGdFWdq59LTnZ1/s6p9gGHglCtWBx9j3fMkS53y1y
41giiY9GXKuEzyHUlSaTT3rLucJCzcJWvHi/k1muqclUn5/Ht2NVHXoLmxVPxgzL
K0bIRYJ9K2R/ou+6YPiV
=zu1M
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org