Skip to content

Instantly share code, notes, and snippets.

@dmitryame
Created May 11, 2011 15:46
Show Gist options
  • Save dmitryame/966715 to your computer and use it in GitHub Desktop.
Save dmitryame/966715 to your computer and use it in GitHub Desktop.
jruby hacks
#jruby hacks
jps -ml #show java processes running
jstack <pid> #get a jvm stack info
jruby -J-Djruby.reify.classes=true # a flag that tell jruby to compile ruby classes to real (matching) java classes
jvisualvm #great profiling tool
ab -n 1000 -c 10 http://localhost:3000 #apache bench command to load up a server
jruby -S warble executable compile war # creating executable war
java -jar myapp.war #run the executable war
java -jar myapp.war --help
# hotline [email protected]
#jruby -S rails new myapp --template http://jruby.org
#produce a heap dump on running tomcat
jmap -dump:live,format=b,file=heap.bin <pid>
#some notes from rails conf
lsof -nPp <pid>
tcpdump -i eth0 -s 0 -nqA
tcpdump -w <file>
then wireshark the file
strace -cp <pid>
strace -ttTp <pid> -o <file>
ltrace -cp <pid>
ltrace -c ruby threaded_em.rb
ltrace -ttT -e memcpy ruby threaded_em.rb
require 'rbtrace'
rbtrace -p <pid> -m <method>
rbtrace -p <pid> --slow=50
rbtrace -p <pid> -c <predefined tracer>
perftools from google feasible for production
perftools.rb
gdb
gdb.rb
gem install memprof
memprof.com
gem install hotspots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment