Building the API

·

2 min read

At first, I was going to invest time on some fancy source code architecture, make it into some sort of batteries system like Django's or Flask's. Then I was like, fuck it, this thing is as simple as simple goes. Put it all in one file. So that's what we have.

I built it and it works. Works well, speed, locally, but I'm getting response time of over 3 seconds when using a hosted database, MongoDB Atlas. Request handlers and database actions are asynchronous, so all that time delay does not become a waterfall. Nevertheless I thought I'd like to improve it.

Of course, the first place to go is a cache. I went with Redis. This is very effective as the read action is what users would be most particular about. They wouldn't worry too much about the time taken to write to the DB as they'd ideally be switching devices during that time.

Still, I'm going to look into how to speed that up. 2 seconds is too long to read or write to a DB.


Unable to finish the above paragraphs, written during development, I'm making a re-write/continuation post-development.

The project is in deployed status. It was fun building it. Pretty straightforward, really.

I spent some time with Tornado again. Did not implement caching. Deployed with Docker + GitHub on GCP, on code push to main branch.

DB read and write wasn't bad really. I'm the only one I know that uses the app and it works good for me.

Sometimes I think stuff broke though, cause I did not implement a "loading" feedback, on the frontend.

Will make updates if I think of anything else to write.

03-04-2021; 1831