I have a few very large nodes on my Drupal 7 site. In some cases the body field contains about 2MB of raw HTML (about 250,000 words). Despite the site performing well as a whole, the sheer size of these nodes causes a complete page render to take about 20 seconds, both due to the amount of content being downloaded and the time it takes the browser to render that much HTML.

The only way I can see to improve performance on these nodes is to load the node body sequentially in small bits, fetching bits of HTML as the user scrolls down the page. Is something like that even possible when all the data is contained in one row in the database? Perhaps this is more of MySQL question, but I'm curious if anyone has encountered this before or has alternate solutions to this problem.


It sounds like you've hit an architecture (DBMS) constraint. I'm not aware of a way to break up a node body into segments easily (I mean i'm sure you could use a list of text fields in drupal -- but ewww).

I'm also not sure of a clean way to make the paragraphs index-able for asynchronous javascript fetching, i believe you run into issues like: https://stackoverflow.com/questions/19477494/per-paragraph-commenting-system

What I would recommend is installing an in-memory cache like Varnish, or Memcache and storing a copy of the full page for anonymous users ... or learning Authcache for more complex scenarios.

  • Thanks for mentioning Authcache, I will check that out. I am already using Memcache + Varnish, but the bottleneck for the really large nodes is mostly in the download + render stage (frontend) vs. backend performance. The browser basically has to render an amount of content equivalent to a 200+ page Word doc, which takes a nontrivial amount of time compared to a typical node. Sep 9 '14 at 22:39
  • so yea, I've seen something like that for large XML files myself. I've never had to optimize it -- but I assume you could at least fetch the content via javascript, maybe websockets (just to throw out a tech-term LOL, that could be totally wrong). But either approach is more a JS question then a drupal one :/ Eg. replace the body with an Authcache fragment(s) ....
    – tenken
    Sep 9 '14 at 22:52
  • You could test the concept quickly enough in a rough form. Create a view that displays a single node in question. Then install authcache views on the view and see how the rendering goes. Sep 10 '14 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.