New full duplex HTTP tunnel implementation (client and server)
https://issues.jboss.org/browse/NETTY-246?page=com.atlassian.jirafisheyeplugin:fisheye-issuepanel
——————————————————————————————————————————————————————————————————
As a contributor to the JXTA peer to peer networking framework, I have been tasked with replacing the HTTP based transport that exists in JXTA. I had recently completed the work to rewrite the TCP based transport to use Netty, and felt it would be a good idea to use Netty for HTTP too. However, I found the existing HTTP tunnel to be unsatisfactory, mostly because it required a servlet container on the server side.
As such, I have create a new full duplex HTTP tunnel using Netty's low level HTTP support. It has been tested in relatively simple setups to date and there are a number of known areas for improvement or fixing, as I would not yet consider myself to be an expert in Netty's inner workings. The implementation uses two TCP connections per channel (two SocketChannels, in fact), one used for sending data from client to server (the "send" channel), the other used for sending data from server to client (the "poll" channel). The technique used is known as Comet, and is necessary to allow usage via a proxy - something which has not yet been implemented but has been planned. There are other intricacies in the implementation, such as an enforced upper limit of 16KB per message body, which is intended to average out the per-byte throughput rather than delivering highly inconsistent payloads. It is debatable whether this works in practice, and is something I would encourage the wider community to discuss and help choose an appropriate threshold.
Issues with the implementation:
1. No proxy support. This isn't difficult, but has not been implemented yet. If this hasn't been picked up by others in the community within the next week, I will likely implement this as a patch extension.
2. Poor connection close handling. The tunnel should be resilient to
requests, forceful or polite, to close a connection that is servicing
the tunnel. While HTTP 1.1 connections can be long lived, some proxies
will close them frequently / at regular intervals.
3. Write fragmenting / aggregating. As mentioned above, an upper limit
is imposed on the size of message bodies sent in each direction. While
the implementation works enforcing the upper limit, it does not attempt
to reaggregate smaller fragments into larger bodies. As a result, the
size of the message body sent may be wastefully small when there is
other data in the outgoing queue.
4. Dealing with the synchronous nature of HTTP. While HTTP 1.1 should
allow pipelining and full duplex communications, most firewalls /
proxies don't like this and therefore we should adhere to a strict
request / response ordering. The implementation does this, but I am
unsure whether the implementation is a good expression of this logic in
netty.
5. Correct handling of the various event types in Netty. This is
probably the part I am least comfortable with. I make an effort to
honour the semantics of ChannelFutures on writes, and deal with
bind/unbind/connect/disconnect, but I am unsure whether these are
correct. In depth review would be greatly beneficial here.
6. Unit tests use jmock - jmock is what I am used to in previous
projects, but I see EasyMock is the testing tool of choice here. The
jmock tests do not appear to run well within maven build of Netty, so
these tests may need to be rewritten using EasyMock to pass QA.
I may think of other issues as time goes on, but for now it is
probably best if we get some wider exposure of this work and some
testing in environments other than my own.
New full duplex HTTP tunnel implementation (client and server)的更多相关文章
- UDP编程中client和server中使用recvfrom和sendto的区别
client中: sendto(sfd,buf,strlen(buf),0,(struct sockaddr *)&saddr,len); recvfrom(sfd,buf ...
- tmux protocol version mismatch (client 7, server 6)
$ tmux attach protocol version mismatch (client 7, server 6) $ pgrep tmux 3429 $ /proc/3429/exe atta ...
- jvm的client和server
最近研究c++代码调用java的jar,发现64位的下的jvm在server路径,而32位的jvm则存在client路径下面,于是十分好奇,查了下,这里做个记录 JVM Server模式与client ...
- Android简单的聊天室开发(client与server沟通)
请尊重他人的劳动成果.转载请注明出处:Android开发之简单的聊天室(client与server进行通信) 1. 预备知识:Tcp/IP协议与Socket TCP/IP 是Transmission ...
- The client and server cannot communicate, because they do not possess a common algorithm
The client and server cannot communicate, because they do not possess a common algorithm This was re ...
- go http client, http server
Go语言中的HTTP client, server非常简单.具体如下. HTTP Server package main import ( "fmt" "html&quo ...
- onvif协议client与server对接
happytimesoft有完整的c语言开发的onvif client和server,一共1000$,真便宜,haha. http://www.happytimesoft.com/products/m ...
- 带入gRPC:gRPC Streaming, Client and Server
带入gRPC:gRPC Streaming, Client and Server 原文地址:带入gRPC:gRPC Streaming, Client and Server 前言 本章节将介绍 gRP ...
- ESP8266 station模式下建立client、server TCP连接
程序实现内容: 1.在station模式下,ESP8266作为client.server进行TCP连接2.实现数据的发送.接收(同时回传)实现思路:TCP网络通信分层为:应用层.网络层.数据链路层.物 ...
随机推荐
- YUV到RGB的转换
以下内容来源于网络,下面三个链接里的内容是比较好的,感谢博主的分享. http://blog.csdn.net/housisong/article/details/1859084 http://blo ...
- andorid源码中察看版本
build\core\version_defaults.mk //搜索该文件中的 PLATFORM_VERSION值
- hdu 4952 Number Transformation (找规律)
题目链接 题意:给你个x,k次操作,对于第i次操作是:要找个nx,使得nx是>=x的最小值,且能整除i,求k次操作后的数 分析: 经过打表找规律,会发现最后的x/i,这个倍数会趋于一个固定的值, ...
- 宏buf_pool_t
typedef struct buf_pool_struct buf_pool_t; struct buf_pool_struct{ /** @name General fields */ /* @{ ...
- 函数fsp_header_init
/**********************************************************************//** Initializes the space he ...
- ASP.NET Redis 开发(转载)
Redis简介 Redis是一个开源的,使用C语言编写,面向“键/值”对类型数据的分布式NoSQL数据库系统,特点是高性能,持久存储,适应高并发的应用场景.Redis纯粹为应用而产生,它是一个高性能的 ...
- POJ 1088 滑雪【记忆化搜索】
题意:给出一个二维矩阵,要求从其中的一点出发,并且当前点的值总是比下一点的值大,求最长路径 记忆化搜索,首先将d数组初始化为0,该点能够到达的路径长度保存在d数组中,同时把因为路径是非负的,所以如果已 ...
- 【C#学习笔记】函数重载
using System; namespace ConsoleApplication { class Program { static void Print(int a, int b) { Conso ...
- jsoup使用选择器语法来查找元素
问题 你想使用类似于CSS或jQuery的语法来查找和操作元素. 方法 可以使用Element.select(String selector) 和 Elements.select(String sel ...
- sql server 2012序列号
MICROSOFT SQL SERVER 2012 企业核心版激活码序列号: FH666-Y346V-7XFQ3-V69JM-RHW28 MICROSOFT SQL SERVER 2012 商业智能版 ...