Sam
Explore posts from serversCDCloudflare Developers
•Created by Sam on 11/11/2024 in #workers-help
rate limiting issues
Hi Im using the cloudflare rate limiting beta, and it works fine when I make my requests through the browser. When I make requests through my local API client (bruno) it seems to have no effect and will never rate limit the user even if they exceed the threshold.
Don't really understand why.
3 replies
CDCloudflare Developers
•Created by Sam on 11/9/2024 in #workers-help
Latency when proxing api calls from my cf worker -> my vps
Hi I have an API hosted on a VPS (typesense search) and when I hit it directly I get response times of 20-45ms when I make the exact same request but put my cloudflare worker infront of it (so request to worker -> vps -> to client).
I get response times of over 300ms.
Both the VPS and me are situated in London.
How can I get this middleman latency down to less than 50ms.
(I dont believe im using smart placement)
4 replies
DTDrizzle Team
•Created by Sam on 10/12/2024 in #help
How to achieve a returning insert with relations
Hey so I noticed this is not currently possible, any advice on how I might be able to do this with the sql api?
https://github.com/drizzle-team/drizzle-orm/issues/2325
1 replies
DTDrizzle Team
•Created by Sam on 1/31/2024 in #help
Performance advice
So I have some queries that are taking over 15 seconds to run on vercel serverless with postgres supabase and brevo emails.
This is an example
https://gist.github.com/samducker/15c3c8e2e70cd86d0721cc584da0901b
So I already went ahead and created relevant indexes on the tables, and the parts of the request that can be parallelised are. However I wonder why this might still be so slow?
I did console time to check the email request is quite slow at 3 seconds. But it still doesnt plain why the request takes 15 secs in total.
Can I log the SQL that is generated somehow? Any advice on how best to investigate further what is the cause? Should I put the email part in a queue?
p.s. many of my other requests are much more performant.
11 replies
DTDrizzle Team
•Created by Sam on 12/11/2023 in #help
Running concurrent queries
Hi so maybe this is more of a SQL question sorry if so.
So I understand the benefit of transaction is to do all of those queries as a unit and you can roll back all the changes if one fails for example.
I also understand you can add await inside the transaction requests if you need them to be dependant on each other.
If I want to just send a bunch of non-dependant queries that get executed in parallel in one request to my DB for example updating a users name in the user table and there bio in the profiles table in one go, would it be best just to promise.all a bunch of normal queries or should I use transaction or batch in this case (I use supabase so not sure if batch is supported with drizzle for me)
Essentially just wondering about what the best methods for scenarios like the above is performance wise. I'm also using serverless so I prefer to limit my number of connections to db where possible.
And I assume promise.all approach might make multiple requests albeit in parallel?
p.s. I also found this question unanswered before making this post
https://discord.com/channels/1043890932593987624/1183316306552954960/1183316306552954960
5 replies
DTDrizzle Team
•Created by Sam on 11/16/2023 in #help
Explaining the differences between .references() and relations function
Hi I'm a bit unclear in the example why the comments table in this example does not use the .references() function on the author id field. Is this because the .relations() method and relations({one}) are achieveing the same thing but two different approaches?
https://orm.drizzle.team/docs/rqb#one-to-many
5 replies