Netty information loading is used to implement a long-connection real-time communication system. The client can be used in any scenario and supports real-time http communication, webSocket communication, tcp protocol communication, udp protocol communication, broadcast protocol, etc. through http protocol and rpc protocol. Use a custom network packet structure to implement a custom network stack.
1: Support distributed zookeeper for service node configuration.
2: Implement netty private message protocol stack in the form of custom annotations.
3: Support remote RPC calls.
4: Support redis.
5: Support db separation.
6: Support synchronous and asynchronous message processing
7: Support kafka message queue supply/consumption model to implement distributed message queue
8: Support data encrypted transmission to ensure data security.
9: Support distributed transaction 3pc submission and exception rollback.
1: Game server
2:Real-time communication system
3: Financial data processing system
4: Systems with high requirements on real-time network performance
5: Common Internet systems
Independent data db module, independent transaction module, independent thread scheduling module. Provide network services in the form of microservices.
TCP communication, using netty to realize TCP communication, you can use comtwjitmcorestartGameService in the project, change the startup mode to tcp server startup mode, you can use testjavacomtwjitmClientServiceTest in test to simulate customers To connect, you need to change the port and address to the tcp server to connect. TCP message processing uses message queues to put all incoming messages into the queue and process the messages through thread pooling technology.
The format of UDP custom network protocol stack is similar to that of TCP custom network protocol stack. The difference is that UDP does not need to establish a connection, which is a stateless communication mode. In the message processing module, the session saved when using TCP connection is used to determine which client it is. The UDP protocol can correctly process messages sent by the client through two different message processing modes, including: synchronous queue mode; producer-consumer mode.
The HTTP protocol is also implemented using a custom network protocol stack, which is similar to the TCP and UDP protocols, except that the data packets are different. HTTP is a protocol built on the application layer of TCP. Use synchronous processing to process messages in a timely manner when they arrive.
The RPC module is divided into synchronous calls and asynchronous calls, remote server calls, using netty to implement a lightweight rpc server framework, and customizing thread concession strategies. Combined with basic Java knowledge such as dynamic proxy, the rpc server communication module is implemented. Use xml documents to configure basic information of the rpc server to achieve dynamic horizontal expansion of the server. Make basic preparations for distributed servers
By integrating zookeeper, dynamic registration services, discovery services, and integrating rpc logic, distributed service discovery and registration are realized.
By integrating kafka services. Implement distributed server message queues and decouple the logic in the system.
Still optimizing, optimizing the space complexity, time complexity, response time, stress testing capabilities and other performance in the project
This project uses spring to uniformly manage some beans. When the server is started, the container initialization is uniformly submitted to spring. Using the annotations provided by spring, it is easy to obtain the bean objects injected into the spring container and improve the readability of the code.
Through thread management, server event updates use independent mode to update server events and queue mode to enable serial execution of events.
Author: Don’t pick up a good nickname casually twjitm qq: 1089718215
Blog address https://blog.csdn.net/baidu_23086307
Personal website address; https://twjitm.com