thephoeron / LLTHW

Learn Lisp The Hard Way source-code and full book text
MIT License
349 stars 57 forks source link

Web App Memory Usage #3

Closed thephoeron closed 9 years ago

thephoeron commented 10 years ago

While performance of the web app appears to be snappy and responsive, no issues with serving static or dynamic content over ajax or standard requests at the moment, it is currently using far more memory than ideal, in some cases over 500mb.

This could lead to performance issues under heavy load, potentially exhausting the stack or having the app automatically terminated if it exceeds memory limits of the hosting account.

Various strategies for improving performance and limiting memory usage need to be investigated and implemented.

thephoeron commented 10 years ago

Forcing full garbage collection, reference symbols hash-table, and replacing automatically generated reference pages with a single easy-handler that accepts a get parameter seems to have greatly improved performance.

Under regular usage, web app now using < 120mb memory.

Additional improvements could be achieved implementing a similar pattern for the Book pages.

thephoeron commented 10 years ago

Added a single regex handler for all book pages, implemented similarly to the reference section, but without GET url params. No more forced recompile to add new pages/handlers too. Memory overhead now down to 70--90 MB under normal traffic.

The Try Lisp and Reference handlers can be further optimized following the same pattern. Possibly using the same handler function.

thephoeron commented 9 years ago

Per commit c869d4b09a77d714f4fb967f73e6014d7e6c1314, removed serving of static files from hunchentoot and moved to nginx. This seems to be improving performance and reliability slightly.