Good news, everyone. I finally remembered to do it on time this week!
Anyway, the vast majority of this week has been dedicated to learning how websockets work.
The first thing we did this week was start getting oriented with our Monday board, which was finally set up with some tasks to work on for our sprints. We also have a Figma board that has schematics for the application overall which we're working on collaboratively and putting smaller tasks on.
Back to the websockets, since we're looking to implement a real-time chat functionality between the AI and the client, and eventually P2P chats, we need direct connections between server and client to pass off that information with low latency. Websockets are obviously the standard protocol for this.
Last week I'd written up a whole Python notebook full of test functions using Starlette, the underlying engine for FastAPI, and I discovered some of the mechanisms of WebSockets through talking to ChatGPT and such.
After a knowledge sync with my coworker on the backend, we got to work setting up a miniature application with a tiny FastAPI server and Svelte frontend. We were able to make two concurrent client connections to the backend without much issue.
We then wanted to explore load testing to see how many websockets a server could possibly take, so I got to work on that alone. I discovered the Python module called Locust, so I decided to use that for this purpose. It has a nice web interface with a GUI, but it was surprisingly difficult to configure a proper connection to the backend. I eventually did get it to work.
Weirdly, though, I noticed that it would start dropping connections exactly after 8174, and I have yet to determine why that number specifically. When I mentioned it to my boss, he told me that we should try testing it on an actual web server, so he spun up the environment on a Linode server and we got the Locust load test to run on there, which started disconnecting even sooner and indeterminately, which is in contrast to how it was on my local machine. We also went through the efforts of setting up SSH between my local machine and that server so I can work off it.
Regardless, I think that's where I'm going to leave it off for this week. I'll probably have to keep testing on the Linode server to see what the deal is with this max connections issue. There's no way it can only be 8174.
Until next time, cheers.
Top comments (0)