Has an idea like this been looked into to solve some of 8ch's problems?
- Use Redis patch, or similar in-memory cache
- Threads and posts only exist as JSON.
- Don't build pages ever again. API endpoints are the replacement.
- Turn frontend into a semi-SPA. Starting off, it can just be a really shitty document.write() mess where a giant string containing HTML is built up from the JSON. This will give it 1-to-1 parity with existing 8ch, and will also be quite fast, though not very maintainable. Can be improved later, perhaps to use a hipster library like Vue or Mithril or React.
- localStorage, maybe Web SQL, is used to locally cache thread JSON, and is updated when the API reports a new post or index/catalog change
- Server's job is to manage cache and respond with updates when there are any
- Could serve only the new posts, or re-serve the entire JSON document for a thread. Not sure which would be faster/better.
Downsides:
- Have to add a fair bit more code to handle caching and make sure cache expiry and refresh is done sanely
- Have to write a bit more JS
- Large threads may load a little more slowly for users since clients will be loading them dynamically, especially on mobile and old devices
- Doesn't really fix other fundamental issues with vichan, but those can be fixed at a more relaxed pace in the future once scalability is improved
- Trading disk IO for frequent cache refresh polling and more concurrent connections (if written in nginx config language or Lua, this can be done insanely fast)
- Tinfoil hatters who refuse to enable Javascript or whitelist it here won't be able to use the site. Maybe the old HTML file building could be a fallback here.
Upsides:
- Scaling should be far easier and cheaper. No more 5 trillion .html files lying around. No more Twig, except for the mod pages and a few minor things.
- Can lead to a much nicer UI once the SPA features are fleshed out
For additional performance, you could bypass PHP and have nginx do most or all of the cache management and API response for you.
I don't know if this is the best option. I think a full rewrite or switching to Lynxchan would be a big mistake. I think a rewrite is maybe not a bad idea for the distant future, but PHP and Laravel weren't the right choices. vichan's internals suck, but in terms of features it's the most mature software out there, and the code isn't so abhorrent that it can't be hacked on (unlike Kusaba X or something).
I posted these suggestions during Infinity Next's announcement thread a while back and said it seemed like a bad idea, but was largely ignored.
I'd be willing to help with a patch to add some of these features if HW shows serious interest in the idea.