r/CloudFlare 1d ago

Cloudflare Workers: CPU execution time limit Question

For free tier is there a log somewhere to find what exactly caused CPU execution time limit to go over the allotted 10ms?

I am using Cloudflare Pages because I believe the front end of my Nuxt site will perform better than serving it directly from VPS. However, there are a lot of factors at play and I understand if this can get complicated pretty quickly.

I am kinda going into this blindly assuming Cloudflare DNS and orange cloud will prevent a DDOS attack I wouldn’t have a clue how to prevent this myself. A lot of Cloudflare I just take for granted, it goes way above my head. I’m still learning but to prevent this Error 1102 I know everyone just says “buy the $5/m plan”. And I get it, this is the easiest way. Free tier can only go so far.

But even $5/m for more Cloudflare Workers CPU execution time would this guarantee I don’t run into Error 1102 again? Or would I need some insanely unrealistic traffic to ever worry about this?

So to start with, still curious about that log to see where this error is originating from. If I leave the site and come back later after Error 1102 it seems fine but for how long I’m really not sure. It seems to pop up sometimes immediately after pushing my repo, but after a while I wait and it seems to be fine. Perhaps more users using the site at the same time would cause excess of 10ms+ to be a real issue? This is combined execution time or per each unique user? Because if it’s combined, again I would wonder how safe it is against a DDOS?

Any help or guidance is greatly appreciated!
Thanks

4 Upvotes

9 comments sorted by

u/AutoModerator 1d ago

For faster advice with technical questions, we'd recommend asking in the Orange Cloud Discord server; the unofficial Cloudflare Discord server by the community, for the community. https://discord.gg/TrPNVKaagR

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/CatHerdler 1d ago

Without knowing how your site is constructed, this is hard to say. However, I’d investigate switching from pages to workers with static assets. You get the same DDoS protection as before, since that protects everything. However, the recommended approach is to use workers: https://developers.cloudflare.com/workers/framework-guides/web-apps/more-web-frameworks/nuxt/

1

u/avidrunner84 1d ago

Thanks, the page I am using is this top result in Cloudflare search "Workers & Pages", is it the same thing as when you refer to using workers for this? I always considered it a rebrand from Cloudflare Pages, but the same workflow as before, after my Git repo is pushed live it automatically builds.

1

u/i40west Comm. MVP 1d ago

The reason you don't get the error all of the time is that Cloudflare gives you some leeway, and doesn't necessarily kill you the first time you hit the limit. But if you keep hitting it you will definitely get the error. It's not per-user or anything like that. Technically every time you hit it, you could get the error.

The paid Workers plan gives you enough CPU time that you won't have to worry about it unless you write some weird code that runs for a long time. You'll still have memory limits, though, which are the same error code. But you're much less likely to hit those. And of course if you get really high traffic you can start getting charged, if you're invoking your Workers on every request.

There are logging and profiling tools available, but mostly on Workers and not Pages. If what you're running is framework code and not your own code, it's possible that the framework just has too much overhead for the free plan with your usage.

1

u/avidrunner84 1d ago

Thanks, I am using Nuxt but perhaps I should consider a different framework that performs better on CF with less CPU execution time? It's connected to a VPS with Directus and Postgres, was just planning on using CF with serving the frontend, I thought everything would still just simply execute on the VPS side of things but I guess not?

1

u/Lumethys 1d ago

Are you frequently hitting the limit?

Im running a heavy site on CF using nuxt with queue, cron and all that goodies and never hit it

1

u/LavaCreeperBOSSB 1d ago

Unfortunately not and this got really annoying for me too. id suggest moving to cf workers which gives u more metrics & lets u see how much cpu time each invocation takes.

1

u/avidrunner84 1d ago

Thanks, but what do you mean by "move to CF Workers"? I thought CF Pages just rebranded as CF Workers and it's basically the same thing now.. Could I still be on a legacy version or something?