Looking back over previous nodes (Perlmonks AJAX Voting, AJAX replacement for voting buttons, AJAX-based Perlmonks.com?), I've seen that in the past there's been resistance to the idea of using AJAX on the site. Objections usually amount to the following (and approximately in this order):

Before discussing this last point, I have to address the first two. So, first of all, this write-up is not about using AJAX because it's cool, or because it'd make the site seem more modern, or even to improve usability (although IMHO that might be a good reason). I'd like to discuss it here only because it might be possible to use it to reduce server load.

Secondly, of course AJAX in itself requires JavaScript. However, there isn't any reason the site can't degrade gracefully (to its current behavior) in the event JavaScript is disabled or otherwise not available. That is, in fact, best practice for any use of JavaScript, so I see this as a non-issue, given that things are done properly with respect to users who don't use JavaScript.

So, that having been said, the main reason previous AJAX additions could increase server load is simply because the server doesn't have support for them. That is, most of these AJAX requests are going to force a complete page re-load in the background, where it's not even visible to the user. But if the server were set up to expect and handle AJAX requests differently, it could be streamlined to simply do the minimal amount of work necessary for this request, and only send a small amount of data back as acknowledgement, rather than rendering the user's entire site view. I am not a pmdev by any means, but isn't this at least possible?

Here are some areas which I think could benefit from the use of AJAX, if the server could handle them in a streamlined fashion (which is to say, by doing less processing and returning less data than a full page reload):

In the end all of these suggestions potential to reduce site load depends on the answer to this question: Which requires the most work for the server, receiving and authorizing incoming requests, or retrieving and rendering all the nodes from the database necessary for a pull-page view?. If it's the former, then these suggestions are a bad idea, since they all require authorization. If it's the latter, then these suggestions could help, by reducing the amount of node rendering the server has to do for these common activities.

Let me conclude by reiterating: This is just a proposal to get feedback, I am not a pmdev, and I don't think we should use AJAX just because it's cool. I'd just like to discuss whether it could actually help with the existing concern of server load or not.

In reply to AJAX to reduce server load by bellaire

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.