• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic compression of Client-Server data  RSS feed

 
Samiul Karim
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All!
I have a stock trading Java-based client-server application. The server sends live stock data to all the clients connected. The application is performing fine but is using up a lot of bandwidth. So, I am planning to perform compression of data at server end and then send the compressed data to the client. I did some research on the topic but did not find any great leads as to how to go about doing it.
I did read about the DeflaterOutputStream but I am not in favour of using it as the compression is done internally in the output stream while sending the packet. Thus, if there are 5 clients connected to the server, the same packet will be compressed 5 times, once for each client.
Is there any other better option?? Even if I get 50% compression, it is OK. The main thing is that compression should be fast and have a low memory footprint.
If anyone has any ideas, please post it.
Thanks
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are some ZipInput and ZipOutput streams. I've never used them, but you might stream to a string once on the server, pump the zipped string to each client, and unzip on the fly at the client.
I wrote a stupid compression program that replaced any 5 duplicate characters with an escape character, the repeated character and a count. 99999 became /905. On the right data - fixed length maingrame data with mucho padding - I got great compression and usually too fast to measure with the PC clock.
Anybody know if the network protocol stacks do any compression? Somebody told me they did a long while ago, but I've never seen it in writing.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!