background preloader


Facebook Twitter

Handshaking tutorial with Netty. Edit: The code for this project is now hosted at GitHub, along with other tutorials.

Handshaking tutorial with Netty

As we all did, I first started using plain NIO for highly scalable network based apps (mostly server-side). Then I jumped to Apache MINA, which I used for just about anything network related until a couple of months ago I discovered Netty. While MINA took the whole Java asynchronous I/O a step further, Netty pushed it two steps beyond that. 50,000+ connection TCP sender, Java NIO w/Netty - 始作俑者 - ITeye技术网站. Handling network timeouts in Java. By David Reilly Overview Handling timeouts is one of those tasks that people generally leave to the last moment.

Handling network timeouts in Java

In an ideal world, we'd never need them. In an intranet environment, where most programmers do their development, it's almost always unnecessary. However, on the Internet, good timeout handling is critical. Architecture of a Highly Scalable NIO-Based Server. If you are asked to write a highly scalable Java-based server, it won't take long to decide to use the Java NIO package.

Architecture of a Highly Scalable NIO-Based Server

To get your server running, you will probably spend a lot of time reading blogs and tutorials to understand the thread synchronization needs of the NIO Selector class and to deal with common pitfalls. This article describes the basic architecture of a connection-oriented NIO-based server. It takes a look at a preferred threading model and discusses the basic components of such a server. Threading Architecture. Windows TCP/IP Server Performance - Rambling Comments. For the last week or so I've been working on measuring and improving the performance of The Server Framework.

Windows TCP/IP Server Performance - Rambling Comments

The latest release of the free version of my asynchronous, windows, IOCP based, socket server framework can now be obtained from here at This week I've had several potential new clients asking about performance numbers for various aspects of the system and so I thought it best to do some measuring. To be able to measure I first had to build a tool to help me. My first potential client was interested in how many concurrent connections our framework could support.

I'd never really tested this and whilst I knew that there were system wide limits that you hit when creating lots of socket connections I'd never looked into exactly what the limits were and when they caused problems. Of course, just opening connections and doing nothing isn't likely to be a real world scenario. The result is a fairly useful tool, EchoServerTest, which is available for download here.

TCPLoadEchoServer / Code / [035c5e] Play! deployment: netty good enough for 5k unique visitors? I use Netty4 to implement IMAP server.

play! deployment: netty good enough for 5k unique visitors?

When the server send big message to the client, channelWritabilityChanged() says that the channel becomes unwritable. That's OK as the size of the message is much higher than the writebufferHightWaterMark. But after the client received the message, channelWritabilityChanged() should get called again as the message in outputbuffer should be lower than writebufferLowWaterMark. But it never happens. (lowwatermark: 16384,highwatermark: 32768) (message size: 180950) Any idea about why it happen like this? Here is how my handlers are registered: pipeline.addFirst(PIPELINE_IDLE_STATE_HANDLER, new IdleStateHandler(socketReadTimeoutInSeconds, 0, 0));

Netty: asynchronous data transfer. User guide for 4.x · netty/netty Wiki. Netty, HttpAsyncClient and Blocking I/O Comparison: Netty, HttpAsyncClient and HttpClient Performance Comparison. I was searching for performance comparison of popular asynchronous HTTP clients, namely Netty, Apache's HttpAsyncClient and blocking I/O HttpClient with thread pool.

Netty, HttpAsyncClient and Blocking I/O Comparison: Netty, HttpAsyncClient and HttpClient Performance Comparison

The research is not just for pure comparison, but also to find the sweet spot of each type of the clients. This is an interesting post. Unfortunately, the comparison is based on file downloading, which is not exactly what most web services are built for. So I decided to run my own analysis based on typical client interactions with RESTful services, where the client sends a request and the server replies with a reasonable size of payload. Clients compared. Part 3: Internet Usage and Protocols. People Internet vs.

Part 3: Internet Usage and Protocols

Device Internet Not surprisingly, people and embedded devices use the Internet very differently. People make use of the Internet largely through the World Wide Web — a set of applications that run on the Internet. Of course, the Web is not the entirety of the human interface for the Internet. We also use e-mail, text messages, mobile apps, and bevy of social media tools. In the Internet of Things, by comparison, autonomous electronic devices exchange information with each other over the Internet.

TCP/IP Protocol Stack. JAVA + SSL Tutorial. Socket programming for scalable systems. In the late nineties I was working for an online video game company where I spent my days writing Unix Berkley Sockets and Windows WinSock code.

Socket programming for scalable systems

My task was to enable video game clients to communicate with a game server. When I had the opportunity to write some Java socket code, I was amazed by Java's streamlined and straightforward approach to network programming. This is no surprise because Java was originally designed to enable smart devices to communicate with one another, which translated very well to desktop and server applications.

In 1996, JavaWorld published "Sockets programming in Java: A tutorial. " Tcp_tutorial.pdf. Eebandbs2_2column.pdf. Java 7 and Java 8 Programming Tutorial: Network Programming. LIMATLecture-11.pdf. Sockets-notes.pdf. Sockets programming in Java: A tutorial. This classic JavaWorld tutorial presents an introduction to sockets programming over TCP/IP networks and demonstrates how to write client/server applications in Java.

Sockets programming in Java: A tutorial

A bit of history The Unix input/output (I/O) system follows a paradigm usually referred to as Open-Read-Write-Close. Before a user process can perform I/O operations, it calls Open to specify and obtain permissions for the file or device to be used. Once an object has been opened, the user process makes one or more calls to Read or Write data. Read reads data from the object and transfers it to the user process, while Write transfers data from the user process to the object. When facilities for InterProcess Communication (IPC) and networking were added to Unix, the idea was to make the interface to IPC similar to that of file I/O. The IPC interface in BSD-like versions of Unix is implemented as a layer over the network TCP and UDP protocols. TCP/IP and UDP/IP communications Datagram communication: Stream communication: Networking (Socket Programming) Tutorial. The term network programming refers to writing programs that execute across multiple devices (computers), in which the devices are all connected to each other using a network.

Networking (Socket Programming) Tutorial

The package of the J2SE APIs contains a collection of classes and interfaces that provide the low-level communication details, allowing you to write programs that focus on solving the problem at hand. The package provides support for the two common network protocols: TCP: TCP stands for Transmission Control Protocol, which allows for reliable communication between two applications. TCP is typically used over the Internet Protocol, which is referred to as TCP/IP.UDP: UDP stands for User Datagram Protocol, a connection-less protocol that allows for packets of data to be transmitted between applications. Finalreport.pdf. Serial Communication in Java with Raspberry Pi and RXTX. Serial communication is one of the ancient technologies in computing that is still relevant today. Its origins date back to the 1960′s when serial communication was used between teletypewriters and modems.

Today, serial interfaces can be found inside myriads of embedded systems where they transfer data between different components. A serial interface is also a common way to connect a PC to an embedded system. Application scenarios include firmware update, logging/debugging, data streaming and many more. In an earlier post I introduced the Raspberry Pi as a great platform for tinkering. History One of the first applications for serial data communication was the connection between teletypewriters and modems. Recent PC models usually don’t have a serial port (RS-232) any more. Hardware.