1) PHP and Node both tend to get significantly better performance than Rails. Either is more than sufficient for free products. See: Facebook, WordPress.com, Medium, etc...
2) Java does well in numerical processing, but it isn't necessarily more performant than node or PHP as a web server and it's a bit of a memory hog. Keep in mind Paypal realized huge gains from rewriting large parts of its Java back-end into Node a few years back. Ditto for Groupon.
3) If you're really worried about web server performance, you're probably better off going with Erlang/Elixirm, a JVM language or Go. If you have something truly massive (e.g. Google/FB/Amazon), then you'll probably hire teams to write infrastructure code in C++. Doing that for a normal web app would be nuts.