4 ms·
I tried to use Headless Chrome on Cloud Functions for a project I'm working on, but even on the fastest instances loading pages was sometimes really slow (pages
by mostlystatic 8y ago
I tried to use Headless Chrome on Cloud Functions for a project I'm working on, but even on the fastest instances loading pages was sometimes really slow (pages timing out after waiting for 60s).
It seems sometimes JS execution was taking a long time, so I guess that was preventing requests from being made. In a single CPU cloud function you have network requests, JavaScript execution, rendering, and the Node process controlling the browser all competing for resources.
That being said, it was super simple to get started!
- leesalminen 8y agoHow many requests per minute were you running? I was planning on using Headless Chrome on Cloud Functions to take in some arbitrary HTML and output it to a PDF. In my case I can’t see >2 rpm happening anytime soon.
- mrskitch 8y agoHave you seen https://docs.browserless.io/docs/pdf.html https://docs.browserless.io/docs/pdf.html? It’s in a docker image too if that’s all you need.
- leesalminen 8y agoJust saw your other comment! The /function call looks interesting. Would I be able to use puppeteer’s request intercept API with it? A bit more on my use case: currently using pdf.js for rendering HTML reports as a PDF. It’s been a pain. I’d like to essentially take the HTML of some (say, just a <table>) or all (full HTML doc) of the current page and send it off. The main gotcha I can think of is relative URLs but intercept request would resolve that.
- mrskitch 8y agoYes: anything available on the `page` object is available in the /function route, so request interception is available!
- pwaai 8y agolooks like Google claims another victim....I don't see the point of using browserless
- python999 8y agoDo simple hello-world HTML pages render ok? I found that rendering was slow-ish but totally acceptable for reasonably heavy HTML pages, so long as we weren't flooding page re-renders (eg by using React without any optimisation of render calls)
- mostlystatic 8y agoYes those were fine.