Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #101246 > unrolled thread
| Started by | livemsn22@gmail.com |
|---|---|
| First post | 2016-01-04 12:50 -0800 |
| Last post | 2016-01-05 10:32 -0700 |
| Articles | 8 — 6 participants |
Back to article view | Back to comp.lang.python
What is the fastest way to do 400 HTTP requests using requests library? livemsn22@gmail.com - 2016-01-04 12:50 -0800
Re: What is the fastest way to do 400 HTTP requests using requests library? Steven D'Aprano <steve@pearwood.info> - 2016-01-05 10:38 +1100
Re: What is the fastest way to do 400 HTTP requests using requests library? Ian Kelly <ian.g.kelly@gmail.com> - 2016-01-04 16:51 -0700
Re: What is the fastest way to do 400 HTTP requests using requests library? Tony van der Hoff <tony@vanderhoff.org> - 2016-01-05 09:53 +0100
Re: What is the fastest way to do 400 HTTP requests using requests library? Steven D'Aprano <steve@pearwood.info> - 2016-01-05 20:38 +1100
Re: What is the fastest way to do 400 HTTP requests using requests library? Tim Chase <python.list@tim.thechases.com> - 2016-01-05 05:43 -0600
Re: What is the fastest way to do 400 HTTP requests using requests library? Paul Rubin <no.email@nospam.invalid> - 2016-01-05 09:02 -0800
Re: What is the fastest way to do 400 HTTP requests using requests library? Ian Kelly <ian.g.kelly@gmail.com> - 2016-01-05 10:32 -0700
| From | livemsn22@gmail.com |
|---|---|
| Date | 2016-01-04 12:50 -0800 |
| Subject | What is the fastest way to do 400 HTTP requests using requests library? |
| Message-ID | <0e42a90b-b736-4050-a20c-6d387048daf3@googlegroups.com> |
So what is the fastest way to make 400 HTTP requests using "requests" library and also using tor proxy? Best regards
[toc] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2016-01-05 10:38 +1100 |
| Message-ID | <568b027c$0$1588$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #101246 |
On Tue, 5 Jan 2016 07:50 am, livemsn22@gmail.com wrote: > So what is the fastest way to make 400 HTTP requests using "requests" > library and also using tor proxy? Since this will be I/O bound, not CPU bound, probably use separate threads. Push the 400 requests into a queue, then create N threads, where N will need to be determined by experiment, but will probably be something like 4 or 8, and let each thread pop a request from the queue as needed. Are you experienced with threads? Do you need further information about using threads and queues? -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2016-01-04 16:51 -0700 |
| Message-ID | <mailman.7.1451951524.2305.python-list@python.org> |
| In reply to | #101249 |
On Mon, Jan 4, 2016 at 4:38 PM, Steven D'Aprano <steve@pearwood.info> wrote: > On Tue, 5 Jan 2016 07:50 am, livemsn22@gmail.com wrote: > >> So what is the fastest way to make 400 HTTP requests using "requests" >> library and also using tor proxy? > > > Since this will be I/O bound, not CPU bound, probably use separate threads. > > Push the 400 requests into a queue, then create N threads, where N will need > to be determined by experiment, but will probably be something like 4 or 8, > and let each thread pop a request from the queue as needed. > > Are you experienced with threads? Do you need further information about > using threads and queues? Also see the concurrent.futures module in the standard library, which makes this sort of setup very simple to implement.
[toc] | [prev] | [next] | [standalone]
| From | Tony van der Hoff <tony@vanderhoff.org> |
|---|---|
| Date | 2016-01-05 09:53 +0100 |
| Message-ID | <mailman.13.1451984029.2305.python-list@python.org> |
| In reply to | #101249 |
On 05/01/16 00:51, Ian Kelly wrote: > On Mon, Jan 4, 2016 at 4:38 PM, Steven D'Aprano <steve@pearwood.info> wrote: >> On Tue, 5 Jan 2016 07:50 am, livemsn22@gmail.com wrote: >> >>> So what is the fastest way to make 400 HTTP requests using "requests" >>> library and also using tor proxy? >> >> >> Since this will be I/O bound, not CPU bound, probably use separate threads. >> >> Push the 400 requests into a queue, then create N threads, where N will need >> to be determined by experiment, but will probably be something like 4 or 8, >> and let each thread pop a request from the queue as needed. >> >> Are you experienced with threads? Do you need further information about >> using threads and queues? > > Also see the concurrent.futures module in the standard library, which > makes this sort of setup very simple to implement. > Why would someone want to make 400 HTTP requests in a short time? -- Tony van der Hoff | mailto:tony@vanderhoff.org Ariège, France |
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2016-01-05 20:38 +1100 |
| Message-ID | <568b8eff$0$1588$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #101263 |
On Tue, 5 Jan 2016 07:53 pm, Tony van der Hoff wrote: > Why would someone want to make 400 HTTP requests in a short time? For the same reason they want to make 400 HTTP requests over a long time, except that they're in a hurry. Maybe they're stress-testing a web server, or they just want to download things in a rush. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Tim Chase <python.list@tim.thechases.com> |
|---|---|
| Date | 2016-01-05 05:43 -0600 |
| Message-ID | <mailman.16.1451994895.2305.python-list@python.org> |
| In reply to | #101264 |
On 2016-01-05 20:38, Steven D'Aprano wrote: > On Tue, 5 Jan 2016 07:53 pm, Tony van der Hoff wrote: > > > Why would someone want to make 400 HTTP requests in a short time? > > For the same reason they want to make 400 HTTP requests over a long > time, except that they're in a hurry. > > Maybe they're stress-testing a web server, or they just want to > download things in a rush. Maybe they just want to generate lots of errors. It's generally more productive to make lots of 200 HTTP requests[*]. ;-) -tkc [*] http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
[toc] | [prev] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2016-01-05 09:02 -0800 |
| Message-ID | <87r3hwarib.fsf@jester.gateway.pace.com> |
| In reply to | #101264 |
Steven D'Aprano <steve@pearwood.info> writes:
> Maybe they're stress-testing a web server, or they just want to download
> things in a rush.
They're stress-testing a web server through a tor proxy? This sounds
abusive to me.
I also wonder whether 400 referred to the HTTP 400 error code rather
than the number of requests to be sent. As in:
- Layer 7 (“400 bad request”) attacks toward our web and application
servers, causing Linode Manager outages
from http://status.linode.com/incidents/mmdbljlglnfd
regarding a big DDOS attack that's been running against Linode.com
(a VPS host) over the past couple weeks.
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2016-01-05 10:32 -0700 |
| Message-ID | <mailman.17.1452015173.2305.python-list@python.org> |
| In reply to | #101273 |
On Tue, Jan 5, 2016 at 10:02 AM, Paul Rubin <no.email@nospam.invalid> wrote: > Steven D'Aprano <steve@pearwood.info> writes: >> Maybe they're stress-testing a web server, or they just want to download >> things in a rush. > > They're stress-testing a web server through a tor proxy? This sounds > abusive to me. > > I also wonder whether 400 referred to the HTTP 400 error code rather > than the number of requests to be sent. As in: > > - Layer 7 (“400 bad request”) attacks toward our web and application > servers, causing Linode Manager outages > > from http://status.linode.com/incidents/mmdbljlglnfd > regarding a big DDOS attack that's been running against Linode.com > (a VPS host) over the past couple weeks. I had the same initial thought about the status code but dismissed it, since why would somebody intentionally send a request that will return a 400 status? I was not thinking about abuse though, so the DDoS scenario did not occur to me.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web