Using the JRuby Profiler
In addition to the profiling tools you saw in VisualVM, JRuby has its own built-in profiler. You can enable this feature by adding the --profile option when starting a JRuby process. To test it out, run the following command:
| $ ruby --profile -S bin/puma |
Make a few page requests, and then kill the process by pressing Ctrl-C. This will dump some statistics to the console that look like this:
| Total time: 19.08 |
| |
| total self children calls method |
| ---------------------------------------------------------------- |
| 17.97 0.05 17.91 50 Kernel.load |
| 16.84 0.00 16.84 1 Puma::CLI#run |
| 16.84 0.00 16.84 1 Puma::Single#run |
| 12.88 12.88 0.00 1 Thread#join |
| 5.62 0.03 5.59 6215 Kernel.require |
| 4.27 0.01 ... |
Get Deploying with JRuby 9k now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.