5 ms·
Is the price for each request or is it request * workers
by erikkri 9y ago
Is the price for each request or is it request * workers
- kentonv 9y agoSame thing. Your site has only one worker script, and each request is therefore processed by at most one Worker. You can of course merge many independent pieces of logic into one script -- it's code, after all. Enterprise customers are allowed to have multiple scripts mapped to different URL routes. This is mainly so that different teams owning different parts of the site don't step on each other. However, generally if you stuff your logic into one script rather than multiple, it will perform better, since that one script is more likely to be "hot" when needed.
- netcraft 9y agoohhh, its one worker per domain, you cant have different ones that match on url? so you have to do that matching in your worker to run different code?
- kentonv 9y agoCorrect.
- deleted 9y ago[deleted]
- elithrar 9y agoNote that Enterprise customers can have multiple scripts-per-domain, allowing you to run specify a specific script per route (or routes). Additional matching logic (e.g. headers, cookies, response codes) can then be done within the Worker itself.
- btb 9y agoHopefully that limitation can be relaxed over time. Having to stuff all my logic in one big script sounds a bit annoying. At minimum having access to a second worker script route would be welcome for testing/development purposes, so one doesn't muck up a working production script.
- kentonv 9y ago> Having to stuff all my logic in one big script sounds a bit annoying. Keep in mind that you can write your code as a bunch of modules and then use a tool like webpack to bundle it into one script, before you upload it to Cloudflare. > for testing/development purposes I agree with this, we definitely plan to add better ways to test script changes. Currently there is the online preview that shows next to the code editor, but it's true that there are some limits to what you can test with it.