Last active
July 18, 2021 23:15
-
-
Save mattfysh/284f266f09260cb1fdd03dc74fe056e0 to your computer and use it in GitHub Desktop.
Luminati Performance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PROXY_URL=<your_proxy_url> | |
| echo "HTTP" | |
| time ( | |
| curl --proxy $PROXY_URL -s -o /dev/null http://example.com | |
| curl --proxy $PROXY_URL -s -o /dev/null http://example.com | |
| curl --proxy $PROXY_URL -s -o /dev/null http://example.com | |
| curl --proxy $PROXY_URL -s -o /dev/null http://example.com | |
| curl --proxy $PROXY_URL -s -o /dev/null http://example.com | |
| ) | |
| echo "HTTP with connection reuse" | |
| time ( | |
| curl --proxy $PROXY_URL -s -o /dev/null http://example.com \ | |
| -: --proxy $PROXY_URL -s -o /dev/null http://example.com \ | |
| -: --proxy $PROXY_URL -s -o /dev/null http://example.com \ | |
| -: --proxy $PROXY_URL -s -o /dev/null http://example.com \ | |
| -: --proxy $PROXY_URL -s -o /dev/null http://example.com | |
| ) | |
| echo "HTTPS" | |
| time ( | |
| curl --proxy $PROXY_URL -s -o /dev/null https://example.com | |
| curl --proxy $PROXY_URL -s -o /dev/null https://example.com | |
| curl --proxy $PROXY_URL -s -o /dev/null https://example.com | |
| curl --proxy $PROXY_URL -s -o /dev/null https://example.com | |
| curl --proxy $PROXY_URL -s -o /dev/null https://example.com | |
| ) | |
| echo "HTTPS with connection reuse" | |
| time ( | |
| curl --proxy $PROXY_URL -s -o /dev/null https://example.com \ | |
| -: --proxy $PROXY_URL -s -o /dev/null https://example.com \ | |
| -: --proxy $PROXY_URL -s -o /dev/null https://example.com \ | |
| -: --proxy $PROXY_URL -s -o /dev/null https://example.com \ | |
| -: --proxy $PROXY_URL -s -o /dev/null https://example.com | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import http from 'http' | |
| import proxy from './proxy' | |
| export default class HttpProxyAgent extends http.Agent { | |
| addRequest(req, options) { | |
| req.setHeader( | |
| 'Proxy-Authorization', | |
| `Basic ${Buffer.from(proxy.auth).toString('base64')}` | |
| ) | |
| req.setHeader('Proxy-Connection', 'Keep-Alive') | |
| req.path = `http://${options.host}${req.path}` | |
| const forwardingOptions = { | |
| ...options, | |
| host: 'zproxy.lum-superproxy.io', | |
| port: 22225, | |
| } | |
| return super.addRequest(req, forwardingOptions) | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"Target domain" = the origin of the website you're scraping
--verboseflag to curl in the commands above to see the client/server messagingx-luminati-timelineresponse header to understand where time is being spent on your remote proxies. You could experiment with different settings to see if this can be improved, e.g. selecting a region for a proxy that is physically closer to the target domainNode.js developers
NODE_DEBUG=netto verify that your connections are actually being reused. Look for the"createConnection"log linereq.reusedSocketflag to see if the request was sent over an existing connectionTodo
-session-<id>to your proxy username, as documented here: https://brightdata.com/faq#integration-persistence/favicon.icoat 45-second intervals? How to determine whether this activity allows the target to detect abnormal behaviour?zproxy.lum-superproxy.io