#silly question about workers billing

29 messages · Page 1 of 1 (latest)

vocal aurora
#

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

lament field
#

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

vocal aurora
#

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?

lament field
#

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.

vocal aurora
#

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

lament field
#

You cannot

vocal aurora
#

drats

#

well thank you

lament field
#

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

vocal aurora
#

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

lament field
#

What's the workload out of interest?

vocal aurora
#

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

lament field
#

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

vocal aurora
#

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

lament field
#

For me, this does stock + crypto, it'd be within the free plan though of course i do have paid

vocal aurora
#

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

lament field
vocal aurora
#

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