Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Architecture: Consider moving away from a monolith #16

Closed
mariano-f-r opened this issue Jan 24, 2024 · 8 comments
Closed

Architecture: Consider moving away from a monolith #16

mariano-f-r opened this issue Jan 24, 2024 · 8 comments
Labels
backend Anything pertaining to the backend enhancement New feature or request frontend Anything pertaining to the frontend code question Further information is requested

Comments

@mariano-f-r
Copy link
Owner

At present, our stack involves a Rust websocket server that pulls double duty as an HTTP server. We should consider separating the front end so that the backend server is more free to handle more concurrent messages.

@mariano-f-r mariano-f-r added backend Anything pertaining to the backend enhancement New feature or request frontend Anything pertaining to the frontend code question Further information is requested labels Jan 24, 2024
@mariano-f-r
Copy link
Owner Author

@Glacier150 @ItsCbass How feasable do y'all think this is? I have no experience in architecture so I'd rather get a second opinion.

@Glacier150
Copy link
Collaborator

I am unfamiliar with the requirements needed for this, so I can't offer any useful insight.

@mariano-f-r
Copy link
Owner Author

@Glacier150 At present, the backend is monolithic. The Rust binary that acts as the Websocket server also serves as the HTTP server. It serves the website and handles chat messages at the same time. The issue with this is that when we scale, many people will be loading the site, putting strain on the server. Simultaneously, people will be chatting,putting more stress on the server. We can't ask our server to do 2 things and for them to do them well. We will have to try to separate our frontend web server from our backend Websocket server.

@ItsCbass
Copy link
Collaborator

I'm not too experienced with architecture dev but I maybe had a few ideas. From our current setup, the single Rust binary looks like its going to be our performance bottleneck. We could move the frontend HTTP shit to a dedicated static site host, using a CDN for our delivery. As for our backend, we could transition to a cloud-based system like AWS. Maybe even working on some microservices to break things down?? Just some thoughts

@mariano-f-r
Copy link
Owner Author

I do think that using a static site host, or even (when we start adding DMs and the like) using a front end server, like a Vercel instance for this purpose. The frontend HTML can just connect to the backend with no issues. Ideally. I have no idea how this would pan out.

@mariano-f-r
Copy link
Owner Author

We should look into rewriting the frontend and hosting it on Vercel. We could do a lot nicer things there and have a much nicer frontend that is completely orthogonal from our backend. Plus it'll let us scale without worrying about bottlenecking anything. I have no idea how to develop for the frontend however.

@mariano-f-r
Copy link
Owner Author

Ok I just had an idea that was revealed to me in a dream. What if we make a SPA that is hosted on Vercel, rewrite the front-end and backend to work with POST requests instead of a websocket connection, and find someway to stream data back to clients. By making it so that messages are not sent by a websocket connection, we can avoid needlessly keeping open a websocket connection. It will also mean that we can more easily implement things like DMs, I think.

Idk, maybe a pipe dream, but i hope that when all is said and done, this essentially turns out to be an anonymous AIM clone that allows for DMs, a big room for all active users, and creatable group chats. Idk that may be a pipe dream, but pipe dreams stay dreams until you face them head on. Better fail trying to make this a pipe reality than leaving it a pipe dream.

@mariano-f-r
Copy link
Owner Author

This issue is stale, and is now a duplicate of #44. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Anything pertaining to the backend enhancement New feature or request frontend Anything pertaining to the frontend code question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants