Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> AJAX/SPA was to provide [...] a less technical UI

I hadn't heard that reason before. Can you please talk more about this?

> This forum is not going to be fast for millions of users (it might not even be for hundreds of simultaneous users) because the server has to render everything again for everyone.

This theory doesn't match reality. In reality, multipage applications are faster than single-page ones. In fact, most things on the internet still are multipage, including web forums. Most web forums are powered by PHPBB, a multipage web app, and they were powered by PHPBB 15 years ago, when hardware and PHP were much slower. This very site is a multipage web app, and it holds up just fine, even though it has enough users to bring down other websites.

Single-page applications seemed like they would be faster, but usually they aren't.

First, let's look closer at a multipage application. All of the scripts, styles, and images should be cached after loading the first page, if you set the headers right (the Expires header, mainly). Therefore, what is left? The content. And I have found that the size of the HTML content is often close to the size of the same thing in JSON --- at least the way I write HTML (I try to keep it lean. Few classes, extraneous divs, etc.). This is because JSON has all those keys:

    {
        "color": "red"
    }
while HTML has just the values:

    <div>red</div>
That was a simple example, but I measured a bigger one, and the size turned out to be about the same, especially after compression. All of those HTML tags compress well, because of repetition.

Now if they are the same size, then they should load in the same time. Except they don't. The server-rendered page loads faster. Why? Because of progressive rendering. When just some of the HTML has come down the pipe, the page appears. But with AJAX, all of the JSON must first load, then be parsed, then wrapped in a template, then inserted into the DOM. Then it appears all at once.



> Can you please talk more about this?

Average Joes want spinners, buttons, draggable stuff, toggles etc. that don't lead to a page load everytime you press them. Sure, you can say that "well just make a multipage app with some jquery". But at some point you're just approaching a SPA with SSR support.

Imagine facebook's chat but everytime you hit enter you had a full page reload :D

> In reality, multipage applications are faster than single-page ones.

I agree. They are faster for a single user when the usecase is a semi static page like a forum. However, the SPA + API model makes stuff easier for the backend side and allows that average Joe UI stuff. It scales well to millions of users.

The thing is, it's not about you. It's about everyone. We want to build services that please the majority and backends that stay up when the majority is logged in.

Also, it really isn't possible to build realtime/dynamic stuff with a "let's render some HTML on the server" mindset. How do you do realtime chat? Realtime games? How do you do a collaborative text editor? and so on.

JSON/SPA/AJAX are not there to so your static forum page loads fast. They are there because of the next generation of the web.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact