silly question about workers billing

hi. i'm currently screwing around with workers to see if it's viable for a thing i want to make. i'm using the free plan and i very specifically do not want to be charged (but cloudflare has my payment details because i'm using the free tier of r2). my understanding is that the free tier of workers limits you to 10ms CPU time per request and just kills the worker after that. and yet my median CPU time is showing as 617ms, see the attached image. is there a way i can verify if this is right or not, and more importantly, is there a way i can check if cloudflare has suddenly started billing me for workers paid or not
No description
16 Replies
Walshy
Walshy2w ago
Unless you explicitly purchase Workers Paid and pay $5/month you will not be charged Having your card on file does not mean we charge - you need to be explicit with what you want us to charge you for
Kris
KrisOP2w ago
that's kind of what i thought, thank you so why is it reporting that high of a cpu time? that should be impossible for 1 request right?
Walshy
Walshy2w ago
As for CPU, it's not a hard stop at 10ms. We allow you to go over, it is normal for some things to maybe take a bit longer so we are not strict. If you were to average higher though you'd see the cpu time limit get exceeded.
Kris
KrisOP2w ago
ah, i see i'd prefer behaviour to be consistent, is there a way i can set the cap myself? i'm basically trying to see what's possible within 10ms of cpu time
Walshy
Walshy2w ago
You cannot
Kris
KrisOP2w ago
drats well thank you
Walshy
Walshy2w ago
But you can do a lot in 10ms and if you do need more, workers paid has up to 5 minutes now. Also, not sure why the dash says 38ms and 600ms average - I think there's a bit of weird reporting happening there. I'd probably say you hit the 38ms not 600ms
Kris
KrisOP2w ago
i see, thank you cpu usage is higher than i expected for this workload tho so i think it makes more sense to just rent a $4/month vps for this
Walshy
Walshy2w ago
What's the workload out of interest?
Kris
KrisOP2w ago
i want to make something that collects price data from crypto exchanges via websocket and stores the data in R2 i basically made a small simulation for a worker that receives websocket messages to see how many messages i could receive before the worker died from cpu time limits say if it was 5 minutes then i'd make a cron trigger to start a worker every 4 minutes but it seems to be under a minute, so vps cheaper shrug
Walshy
Walshy2w ago
Should be basically no CPU time there, bit of cpu handling the message and inserting. Either way, yeah do as you wish - if you prefer VPS that works. I also do something similar but I don't use WS, just hit the API on cron and throw it into Analytics Engine where I then track on Grafana
Kris
KrisOP2w ago
i expected minimal cpu time, but it is receiving somewhere in the region of 10-100 messages per second, so i guess i set my expectations too high
Walshy
Walshy2w ago
For me, this does stock + crypto, it'd be within the free plan though of course i do have paid
No description
Kris
KrisOP2w ago
if i was just getting data from a REST API then i'd absolutely use a worker, but for my use case i want websocket data because i need accuracy down to the second for many trading pairs
Walshy
Walshy2w ago
yeah ok, for that volume you're likely parsing each one and things so yeah, will use cpu expectedly.
Kris
KrisOP2w ago
it's fine, i just had unrealistic expectations, which is why we test things i'll still use R2 to store it and a worker HTTP endpoint to retreive the data :3 thank you for your help

Did you find this page helpful?