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 8010363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:42:53+00:00 2026-06-04T18:42:53+00:00

I am developing a stand-alone java application which gathers data from around 1000 measuring

  • 0

I am developing a stand-alone java application which gathers data from around 1000 measuring devices over the network and persists the data to a database.
The data gathering can take a couple of minutes per device due to slow device output and/or network speed. The data gathering must take place in a certain time window, so i need to work in parallel.

My approach would be to create one thread per measuring device, put the data in a queue and have one or more other threads at the other end of the queue transform and persist the data.

Is this a viable approach? Will a modern machine be able to handle that many threads and network connections? How scalable is this, at what point would i need to work on several machines?

I would also be grateful if you could give me pointers with regard to the concurreny classes you would recommend (i.e. what kind of queue, ThreadPoolExecutor etc – i havent used java.util.concurrent yet, book is in the mail).

Are there any better approaches?

UPDATE:

Thanks for the answers so far, here is more information requested by some of you.

The data i receive from the devices is in the form of files smaller than 1kb. It is possible that i get something like 25.000 files during one transfer, although usually its far less.

The data transformation is nothing cpu-intensive, basically parsing the file and converting it to java data types (the file contains c-data-types like unsigned char and unix timestamps), plus a CRC calculation. I create an object containing the content of one file which i persist to the datbase using JPA (i guess i could use plain JDBC as well for this case). There is no order in the measurements-files, since they contain the device s/n and a timestamp.

At a later point in time i will have to add some kind of alert when certain criteria are met, but again this shouldn’t be cpu-intensive.

From the answers so far i gather the network connections and number of threads shouldn’t be a problem.

The only thing i’m left wondering is about the approach with the queue. An alternative would be to let the data-gathering threads also call the DAO method to persist the file. I guess i have to make the DAOs thread-safe anyway, but i think a few threads could do the job as well, since the bulk of the time will be spent transferring network-data.

Also i will look into asynchronous I/O and some frameworks that provide it.

Thanks again, i will choose an answer a little bit later, maybe i will get some more input 🙂

  • 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-04T18:42:54+00:00Added an answer on June 4, 2026 at 6:42 pm

    With the default settings you’ll end up using around 1Gb of memory for the threads’ stacks, given you are running on 64-bit Linux, Oracle jdk (default threadstacksize is 1Mb on such a platform). I think for OpenJDK it is the same. Not counting buffers allocated by the os . . .

    If this is too much for your requirements, you may want to have a look at http://netty.io. This framework uses java nio under the hood (can be configured to use bio, btw). This way you would just require a handful of threads for doing the actual io (performing read/write ops on for a given tcp connection). Your business logic (update db, calculate some measurements) should then be offloaded into a separate threadpool. Netty also includes support for this.

    If you want to use 1 thread per connection (per measuring device?), then there is probably no benefit from having yet another bunch of threads doing the actual business work. I assume one thread per device, because you said that the device can be slow and/or the network can be slow. Both bottlenecks (network and device) won’t be eliminated if you’re using multiple threads (one can expect the opposite).

    Concurrency classes in general: java.util.concurrent.* yep, both thumbs up

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

Sidebar

Related Questions

I am developing a stand-alone java application which uses eclipselink. It is all fine
I'm developing a simple, stand-alone, command line Java application. The project is managed by
Hai I am developing a standalone application using Java in which I am using
When developing a stand alone application for windows, what type of application should i
Currently I am on a team developing a new stand alone application in C#.
I am developing a C# a stand alone single user desktop application that requires
We are developing Stand alone application in .net compact framework 2.0 targeting windows ce
I am developing application as stand alone single system till now . Now i
I use joomla to manage a website... and i am developing a stand alone
I am developing a Math application which can be extended by writing python scripts.

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.