Skip to content

Memory profiling

Jeff Allen edited this page Dec 9, 2013 · 4 revisions
  • You can run shiny-server with the --memlog switch to instruct Shiny Server to periodically log the process's RSS, heap total, and heap used to mem-<pid>.csv every 2 seconds.
    • You can then run tools/memlog-view.R to display
  • To determine the open handle count of shiny-server, you can do lsof -p `pidof node` | wc -l.
  • For interactive profiling (using node-webkit-agent):

Generating load

You'll need to change the URLs in these test files to fit your setup. (TODO: Make these scripts work out-of-the-box)

phantomjs-based

The scripts at manual.test/phantomjs/* simulate real browsers hitting the URLs in those scripts. When testing with phantomjs 1.9.1 I had to run these in parallel to generate enough load on the server, and phantomjs crashed a lot when I launched too many "browsers" at once in a given process.

Mocked

The script at manual.test/loadtest.js uses raw node.js calls to simluate the traffic a normal browser generates. It uses websockets. Run it with no arguments for usage. Currently it only works with the 01_hello example app that ships with Shiny. This script is capable of generating far more requests than the phantomjs based scripts but since it doesn't act like an actual browser it's not very flexible.

Miscellaneous Resources

DevTools

When using node-webkit-agent as described above, it's helpful to know what you're looking at. A couple of useful resources from Google: