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

  • Home
  • SEARCH
  • 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 4083484
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:19:06+00:00 2026-05-20T18:19:06+00:00

I am developing a website/online-service for document collaboration that runs on JBoss. During testing

  • 0

I am developing a website/online-service for document collaboration that runs on JBoss. During testing on a Linux machine with 2.5Ghz cpu and 2GB RAM the page response is very fast and we are considering to launch with this machine.

The problem arises during document processing. After a user uploads a document a new thread is started that among other things converts the document, extracts text and images from the document and uploads the document through https on another server. A user can upload many documents at once and the threads for processing them work concurrently. Until this processing finishes the website becomes almost unresponsive.

Can you give me some advice on how I could somehow allocate a percentage of CPU/memory (e.g. 40% max) on the threads that process the documents? If this is not possible, please advise me on a methodology/pattern that will somehow share the load on the machine between JBoss responding to page requests and the threads that process the documents.

Regards

  • 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-05-20T18:19:07+00:00Added an answer on May 20, 2026 at 6:19 pm

    There’s not really a way to allocate a certain percentage of CPU/memory time for a given thread. You could lower the thread priority so it doesn’t saturate all resources:

    int oldPriority = Thread.currentThread().getPriority();
    Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
    // process your documents here
    Thread.currentThread().setPriority(oldPriority);
    

    A better approach that will probably get you closer to specifying a percentage will be to use an ExecutorService with a fixed number of threads and run all of your document processing through that. If you give it half of the number of processors in your server then it’ll effectively limit the document processing to 50% of the server CPU time. You’d want a singleton service that sets up a thread pool like this:

    int threads = Runtime.getRuntime().availableProcessors() / 2;
    ExecutorService service = Executors.newFixedThreadPool(threads);
    

    Then in your web requests you could pass a Callable that implements your document processing to the service, and block until it is complete:

    Callable<Result> callable = new DocumentProcessorCallable<Object>(doc);
    Result result = service.submit(callable).get();
    

    Or you might prefer to not block and return immediately by providing an implementation of Runnable that you pass to service.execute(runnable). See ExecutorService for more examples and documentation.

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

Sidebar

Related Questions

I am developing a website that relies much on XML data. The web site
I'm developing a website (in Django) that uses OpenID to authenticate users. As I'm
I am developing a website using SQL Server Express on my development machine. My
I'm currently developing a website that should also work on mobile devices. But since
Developing a website and just trying to get back into the swing of (clever)
I'm considering developing a website similar to stackoverflow, but the answers may also consist
I’m developing a website of a client and they are sending out newsletters to
I'm developing a website. I'm using a single-page web-app style, so all of the
I am developing a website and for the main navigation, I was thinking it
I'm developing a website (using asp.net by the way) and I'm having a problem

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.