r/sveltejs • u/Inevitable_Pepper532 • 5d ago
Help a beginner. The task is to create a server that handles responses.
I need to build a server SvelteKit where users can connect and submit their answers. My question is: how many simultaneous connections can such a server handle?
At peak times, up to 200 users might connect simultaneously. They will load an initial page containing an image, a question, and multiple-choice answers. Then they will click on their chosen answer. Each submitted answer will be saved into an SQLite database. Is this feasible? Specifically, would it work on a basic VDS (Virtual Dedicated Server) with one CPU core and 2 GB of RAM?
Thanks!
6
u/canarydev 5d ago
200 is nearly no users. a 1 core 2gb box will handle that fine.
only thing to watch with sqlite is its one writer at a time, so turn on WAL mode and set a busy timeout. 200 inserts is nothing though, it does thousands a second.
id worry more about the image tbh, keep it small or serve it from a cdn.
1
u/FluffyBunny113 5d ago
That is not an issue. But you get the image of how this works wrong. You seem to believe that when a user visits your app a "connection" is kept open between your server and the user but that is not the case. Instead you have a request sent to the server and a response send back, end "connection". Those calls last absolutely no time whatsoever and are super fast.
1
u/kevinkace 5d ago
Have you considered using an existing platform instead of writing from scratch?
3
u/AByteAtATime 4d ago
I feel like the people are being unnecessarily harshyou for no reason - everyone has been a beginner at some point!
u/canarydev‘s response was great; to add on, anything less than thousands of users shouldn’t be an issue. The SQLite WAL was a smart point, too - I definitely would have missed that haha. Depending on your images, you may want to put it behind Cloudflare and use its cache (if you have a few static images) - but honestly, it shouldn’t matter.
In the grand scheme of things, most frameworks now are decently fast enough that it’s a matter of which one you prefer working with more - personally, I really like the Svelte language! You can try it around by playing around with it; it generally adheres to web standards, so pivoting later down the line shouldn't be too hard.
1
u/jackorjek 5d ago
dedicated server is overkill. cloudflare should work just fine and free
1
u/AndrewNggg 5d ago
Why not just deploy on CloudFlare and use also their database
You can scale as big or little as you need