-
Notifications
You must be signed in to change notification settings - Fork 290
Memory profiling
- 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 tomem-<pid>.csv
every 2 seconds.- You can then run
tools/memlog-view.R
to display
- You can then run
- To determine the open handle count of
shiny-server
, you can dolsof -p `pidof node` | wc -l
. - For interactive profiling (using node-webkit-agent):
- Set the environment variable
DEBUG_PORT=9999
before starting Shiny Server (or justDEBUG_PORT=9999 shiny-server
) - Start node-webkit-agent by starting shiny server with the
--agent
switch or by doingkill -SIGUSR2 `pidof node`
- Navigate Google Chrome to http://c4milo.github.io/node-webkit-agent/26.0.1410.65/inspector.html?host=localhost:9999&page=0
- Set the environment variable
You'll need to change the URLs in these test files to fit your setup. (TODO: Make these scripts work out-of-the-box)
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.
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.
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:
- Intro to memory in Node
- Detailed overview of using DevTools for memory profiling. Be sure to check out the nested Demos.