So it’s been the 3rd prototype that I made for 4Chad, it’s finally something I think is presentable by my standard.
Not good enoughs
The first prototype was made from OpenResty and SQLite, pretty much functional. First envisioned it because I had experience in embeded hardware and I knew SQLite is good enough for things more complicated than a imageboard. But I dropped it because SQLite is not good enough for web development, there’s no concurrency in write, multi thread write is a problem, and it does not scale even to 2 servers. Wasted A LOT of time.
The second prototype was made from OpenResty and Mariadb, pretty much functional again plus privileges and JWT logins. Dropped it because it’s too heavy, it’s just not simple enough, Mariadb is a few hundred MB and my code is so simple it’s only a few lua files, I think it’s too “niggerlicious”? I am using a half Gig database to run a few lua files? Also I implemented my own authentication, it’s the most complicated part of the whole site. It’ll work in theory, but would I be sure it’ll be safe? Should the most complicated part of the site be code for jannies? This just ain’t right. Wasted A LOT of time again.
The third prototype was made from OpenResty and Redis. This is the most satisfiable build to me, and I think it’ll finally be presentable.
In the middle of development, I wrote coding guidelines for myself:
1. Don’t wait for client
Load fully, query, respond. Do not let user hog db connections.
If client is too slow in request or response, drop him on his bum.
2. Don’t take heavy loads
Shift complicated scenarios to existing solutions, don’t even waste time reinventing the rocket, just steal it from the Nazis.
3. Comment the code
There’s always a guy who doesn’t understand your code on the second try and gives up and calls you bad because he’s a nigger mutt.
4. Don’t use short abbreviation variables
Use full name variables always. Faggots think they’ll recognize their pretty codes in 12 month but they won’t, they just write their library again and think it’s new.
The goal is to make the implementation as simple as possible, because less is more, got that from TAD.
Working with Redis was a paradigm shift for me, I worked with RDBMS so much I almost couldn’t believe I can run a whole site with 1 index faster than 15 indexes. I finally understood the power of JWT, I shifted the jannie authentication part to a IDaaS provider, and will use JWT as a method of authenticating jannies, managing their privileges, and securing API endpoints. Code for jannies will be kept to a mimimum.
And I developed a datastructure for supporting ANY kind of content. I eliminated the concept of threads and replies and went with hiearchial graphs. And I eliminated the concept of post entry containing the post text and went with post being an object containing metadata and pointing to objects called contents, and contents will be dealt seperately from posts.
Basically you create a post via post API on 4Chad, the response gives you JWTs to upload to an external content endpoint, you upload to the content endpoint in parallel with the JWTs, and the external endpoint webhooks to the 4Chad telling 4Chad the URL of the uploaded content, then 4Chad serves those URLs to every browser.
Now imagine jannies mopping a post, he creates a post first, then attach his
application/4chad.janniescript.v1 content to his post, janniescript is executed, moderation is done, and mod logs are public.
Now imagine some schnizo wants to sign his message, all he needs to do is create a post, attach his
text/plain message as a content, and attach his
application/pgp-signature as another piece of content. Now opt-in PGP messaging is doable. Can you imagine a imageboard with no registration but everyone could be identified with their own PGP keys? This is how the internet should have been, don’t create an account, your key is your only identifiable information.
Now imagine you want to develop an application on top of 4Chad, let’s say a Like function(don’t do it faggot), you only need to upload an extra bit of content with mime type of
application/4chad.like. People who want to ignore the like function can ignore that mime type, people who got their 4Chad like function browser plugins are able to read that piece of content and interprit it as a Like to another post, and you can do custom content ranking or whatever, you can even build a Reddit on top of 4Chad, and people can choose to use it.(don’t do it don’t you dare)
What makes this possible is that I seperated the concept of post and content. Seems simple, but this brings sooo much versatility to an image board, it’s HUGE.
If you’re just a consoomer and you don’t understand me, just get this:
You can upload ANY type of content you desire, in parallel, incredibly fast, and you can install browser plugins that builds on top of 4Chad that gives you previously unimaginable ways of doing things on a imageboard, because the previous imageboard data structures are incapable of expansion.
Vocaroo probably will not be used on 4Chad as in 4chan, because in the future, you can press a record button on 4Chad and it will be uploaded as a
audio/mp3 and anyone who scrolls through your post will hear your screech. This function is going to be so simple to build thanks to the way 4chad API operates.
It’s mostly finished, see you soon.
Performances? jMeter tested 9k+rps get post, 1k+rps write post on my t460 thinkpad with a ton of things running in the background, should be a ball park figure, I’ll do a benchmark in the future.