Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8090967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:54:12+00:00 2026-06-05T19:54:12+00:00

I need to decode binary messages coming at a high rate(>1000 msgs/sec) and store

  • 0

I need to decode binary messages coming at a high rate(>1000 msgs/sec) and store them in a DB(not decided on which one) using JAVA. There would be multiple TCP connections coming into this server each with its own stream of binary data that needs to be processed.

The messages are not separated by any “flags”.

The starting of the message has a 4 byte length field. It is followed by a fixed header.

The payload of the message would be in turn multiple messages, each having a fixed header and followed by bit masks(32 bits) that determine what other fields are present. Each bit mask field is 32 bits and the bits 32-30(MSB -32 / Big endian) specify the length of each of the optional fields. All the other bits(29-1), if “ON” means that the field is present in the message.

For example, if bits 32-30 are 100, and bit 1 is “1”, then field XXX follows the bit mask field and it is 4 bytes long. If bit 2 is “0”, the field YYY is not present in the message and so on.
There would be multiple bit mask fields(optional) present but limited by a max number.
I’m new to java(c/C++ background) so questions maybe …

1) I’m thinking to design the app in the regular way that the “main” thread receives the connections and creates a “worker thread A” to process messages on that socket. I’m thinking of letting the config file drive whether the “workerThread A” creates a threadPool for handling each message or does it on his own. I’ll implement the former and check out the performance and see whether it needs to be improved.
My question is, are netty or Apache Mina good options to consider? Since it is a POC effort, i need to crank it up quickly.

2) I thought of using nio – SocketChannel and ByteBuffer. But it seems like that I cannot read a specified number of bytes from the socket? I’m thinking it would be easier to “readInt()” to get the length and then read “length” number of bytes from the socket to get a complete one message an then parse it. Is DataInputStream a better one to use? Any performance impacts will be there from using oio vs nio?

3) Should i be looking at any frameworks to decode the message? I looked at Google Protocol buffers a little bit but it does not appear as if it would support decoding bit mask fields.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:54:14+00:00Added an answer on June 5, 2026 at 7:54 pm

    I would create one worker thread per connection.

    I would use DataInputStream, unless you determine this is not fast enough. There is a small performance impact, but its unlikely to matter at 1000 msg/sec.

    I would just decode the message as it arrives using the JDK. I haven’t found third party libraries to make things simpler in this situation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some files that are uuencoded, and I need to decode them, using
I have several encoded strings and I need to decode them, my guess is
I need to decode e-mails saved from Outlook as Text Only. Unfortunately they're not
I need to encode and decode IEEE 754 floats and doubles from binary in
I need to decode a packet sent using TIBCO-RV and pull fields out of
I need to decode a data structure containing date and time. Most of the
I need to decode and specifically target the first url only in this array:
I have a Visual Studio 2008 C++ project where I need to decode a
I have this JSON from Google GeoCode and I need to decode this and
I need to encode/decode UTF-16 byte arrays to and from java.lang.String . The byte

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.