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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:14:38+00:00 2026-05-14T21:14:38+00:00

Is there a known algorithm for implementing a connection pool? If not what are

  • 0

Is there a known algorithm for implementing a connection pool? If not what are the known algorithms and what are their trade-offs?
What design patterns are common when designing and programming a connection pool?
Are there any code examples implement a connection pool using boost.asio?
Is it a good idea to use a connection pool for persisting connections (not http)?
How is threading related to connection pooling? When do you need a new thread?

  • 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-14T21:14:39+00:00Added an answer on May 14, 2026 at 9:14 pm

    If you are looking for a pure thread-pooling policy (may be a connection or any resource) there are two simple approaches viz:-

    1. Half Sync/Half Async Model (usually using using message queues to pass information).

    2. Leaders/Followers Model (usually using request queues to pass information).

    The first approach goes like this:-

    • You create a pool of threads to
      handle a resource. Often this size
      (number of threads) needs to be
      configurable. Call these threads
      ‘Workers‘.
    • You then create a master thread that
      will dispatch the work to the
      Worker threads. The application program dispatches the task as a
      message to the master thread.
    • The master thread puts the same on
      the message Q of a chosen Worker
      thread and the Worker thread removes itself from the
      pool. Choosing and removing the
      Worker thread needs synchronization.
    • After the Worker completes the
      task, it returns to the thread-pool.

    The master thread itself can consume the tasks it gets in FCFS or a prioritized manner. This will depend on your implementation.

    The second model (Leader/Followers) goes something like this:-

    • Create a thread pool. Initially all
      are Workers. Then elect a
      Leader, automatically rest-all become followers. Note that electing
      a Leader has to be synchronized.
    • Put all the data to be processed on a
      single request Q.
    • The thread-pool Leader dequeues
      the task. It then immediately
      elects a new Leader and starts executing the task.
    • The new Leader picks up the next
      task.

    There may be other approaches as well, but the ones outlined above are simple that work with most use-cases.

    Half Sync/Half Async Major Weakness:-

    • Higher context switching,
      synchronization, and data copying
      overhead.

    Leader/Follwers Major Weakness:-

    • Implementation complexity of
      Leader election in thread pool.

    Now you can decide for yourself the more correct approach.
    HTH,

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

Sidebar

Ask A Question

Stats

  • Questions 437k
  • Answers 437k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you want to make things "simpler" and stay away… May 15, 2026 at 4:13 pm
  • Editorial Team
    Editorial Team added an answer 2010: For Gitolite 2 (might have changed for gitolite 3)… May 15, 2026 at 4:13 pm
  • Editorial Team
    Editorial Team added an answer Since IE is stupid and whatnot, it wouldn't surprise me… May 15, 2026 at 4:13 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.