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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:57:15+00:00 2026-05-24T22:57:15+00:00

I am trying to implement a basic lib to issue HTTP GET requests. My

  • 0

I am trying to implement a basic lib to issue HTTP GET requests. My target is to receive data through socket connections – minimalistic design to improve performance – usage with threads, thread pool(s).

I have a bunch of links which I group by their hostnames, so here’s a simple demonstration of input URLs:

hostname1.com - 500 links
hostname2.org - 350 links
hostname3.co.uk - 100 links
...

I intend to use sockets because of performance issues. I intend to use a number of sockets which keeps connected (if possible and it usually is) and issue HTTP GET requests. The idea came from urllib low performance on continuous requests, then I met urllib3, then I realized it uses httplib and then I decided to try sockets. So here’s what I accomplished till now:

GETSocket class, SocketPool class, ThreadPool and Worker classes

GETSocket class is a minified, “HTTP GET only” version of Python’s httplib.

So, I use these classes like that:

sp = Comm.SocketPool(host,size=self.poolsize, timeout=5)
for link in linklist:
    pool.add_task(self.__get_url_by_sp, self.count, sp, link, results)
    self.count += 1
    pool.wait_completion()
    pass

__get_url_by_sp function is a wrapper which calls sp.urlopen and saves the result to results list. I am using a pool of 5 threads which has a socket pool of 5 GETSocket classes.

What I wonder is, is there any other possible way that I can improve performance of this system?

I’ve read about asyncore here, but I couldn’t figure out how to use same socket connection with class HTTPClient(asyncore.dispatcher) provided.

Another point, I don’t know if I’m using a blocking or a non-blocking socket, which would be better for performance or how to implement which one.

Please be specific about your experiences, I don’t intend to import another library to do just HTTP GET so I want to code my own tiny library.

Any help appreciated, thanks.

  • 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-24T22:57:17+00:00Added an answer on May 24, 2026 at 10:57 pm

    I finally found a well chosen path to solve my problems. I was using Python 3 for my project and my only option was to use pycurl, so this made me have to port my project back to Python 2.7 series.

    Using pycurl, I gained:
    – Consistent responses to my requests (actually my script has to deal with minimum 10k URLs)
    – With the usage of ThreadPool class I am receiving responses as fast as my system can (received data is processed later – so multiprocessing is not much of a possibility here)

    I tried httplib2 first, I realized that it is not acting as solid as it acts on Python 2, by switching to pycurl I lost caching support.

    Final conclusion: When it comes to HTTP communication, one could need a tool like (py)curl at his disposal. It is a lifesaver, especially when one is dealing with loads of URLs (try sometimes for fun: you will get lots of weird responses from them)

    Thanks for the replies, folks.

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

Sidebar

Related Questions

I'm trying to implement some basic linear algebra operations and one of these operations
I'm trying to implement the WMD editor used on StackOverflow to create some basic
I am trying to implement performance testing on ActiveMQ, so have setup a basic
I'm trying to implement a data compression idea I've had, and since I'm imagining
I am trying to implement PayPal IPN functionality. The basic protocol is as such:
I'm trying to implement basic auditing with some of my models (like CreatedAt, UpdatedAt,
I am trying to implement a basic full-text search with MySQL. I wrote this
I'm trying to implement a basic Health/Stamina/Mana readout in a Windows Forms application, and
I'm trying to implement a basic object-oriented ANSI C runtime and using Objective-C as
I'm trying to implement a basic jQuery infinite carousel. As much for the learning

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.