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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:26:21+00:00 2026-06-12T10:26:21+00:00

Consider one big task which could be broken into hundreds of small, independently-runnable tasks.

  • 0

Consider one big task which could be broken into hundreds of small, independently-runnable tasks. To be more specific, each small task is to send a light network request and decide upon the answer received from the server. These small tasks are not expected to take longer than a second, and involve a few servers in total.

I have in mind two approaches to implement this using the Executor framework, and I want to know which one’s better and why.

  1. Create a few, say 5 to 10 tasks each involving doing a bunch of send and receives.
  2. Create a single task (Callable or Runnable) for each send & receive and schedule all of them (hundreds) to be run by the executor.

I’m sorry if my question shows that I’m lazy to test these and see for myself what’s better (at least performance-wise). My question, while looking after an answer to this specific case, has a more general aspect. In situations like these when you want to use an executor to do all the scheduling and other stuff, is it better to create lots of small tasks or to group those into a less number of bigger tasks?

  • 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-12T10:26:22+00:00Added an answer on June 12, 2026 at 10:26 am

    is it better to create lots of small tasks or to group those into a less number of bigger tasks?

    It’s hard to generalize with a question like this but in your case, I think it makes no sense to create some tasks that each do 5 to 10 things and then submit that to an executor service.

    I would submit all of the work as a bunch of individual, small tasks to the ExecutorService. I think this would make the tasks much cleaner from an object/code perspective. They don’t have to have a collection of requests/responses and can concentrate on making one request and processing one response.

    One exception to this would be if you wanted to not send concurrent requests to a particular server. Then it would make sense to have a task do all of the requests/responses for a particular server and to submit a task for each server.

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

Sidebar

Related Questions

Consider a table products which has product details including its category. One product may
I'm having trouble aggregating multiple arrays into one big array, I think this should
Consider an application which periodically executes a background task via setTimeout / setInterval .
Consider one has some user defined types, and containers of those types that are
Consider three tables: one of items, one of tags on those items, and the
Consider this case: public Class1 { public static final String ONE = ABC; public
Consider the case of blogspot.com the domain is the one blogspot.com only but suppose
Consider that I have 1 resource and 2 urls (let's say new one and
Consider these two classes mapped to the same table. One is readonly via mutable=false.
So I don't consider myself a novice at MySQL but this one has me

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.