Home > Back-end >  Web development master come in, want to ask you a netty server problem
Web development master come in, want to ask you a netty server problem

Time:09-19

N years, for the second time in CSDN Posting, deficiency, thank you for your correct


Because the company is to do things that, with the help of TCP protocol message, the author is mainly responsible for the development of TCP client this piece, logic is very simple, basically on the server, sends authentication, waiting for the return, if successful, send a heartbeat, processing the heart back, accept the server-side distributed control instruction; If authentication fails, continue to reconnect to server timeout, send certification... Basic no problem, if the client some cases unable to reconnect to server, it is the client's bug,

Is the service side each update after the restart, a large number of client start sending login authentication, leads to server problems, performance phenomenon are as follows:

1, some client has sent certification, server also returns the authentication is successful, then the heartbeat is normal, the service side sometimes display device or offline, sometimes show online, but at this time the client can't receive any server control message, I said it was a server problem, he says it is the client's problem, I don not independent enough
2, also have this kind of circumstance, the client unplug, after server restart, server display device or online, arguably, the TCP service after the restart, record all the TCP session id before no meaning, so generally don't have to persistent storage right, are stored in the memory inside, I don't know why they use the persistent storage



In addition, don't know those such as tencent qq, WeChat, including certification, state storage and so on all is how TCP to communicate with the server, and about our current design problem:


1, TCP message transmission limited in 65535, because they two bytes, design of baotou with Netty separators decoder DelimiterBasedFrameDecoder, I personally feel that unpacking efficiency is too low, should consider LengthFieldBasedFrameDecoder subcontract mechanism efficiency highest

2, TCP packet transport efficiency is too low, even if the heartbeat package under the condition of actual transmission content is empty, also can produce 62 - byte packets, because they require every TCP packet authentication information on the attached, is not clear why do

3, TCP is arguably only when the first connection need the certification, as long as the current TCP connection is open, after a TCP session id does not change, the certification status will not change, do not need every message validation, personal feel every time check packet without wasting a lot of server computing resources, could also lead to the server after each reboot instantaneous processing not over

4, what do they do all TCP packet data the xor operation, get a value, the receiver to calculate again every time, but can't achieve encryption, data in the running of the state on the public network, TCP communication is to realize reliable transmission, other people think is redundant

5, should consider the TLS encryption, including certificates of certification, management and so on?
  • Related