Do we need rust compiler in production to run yjit?
You need a rust compiler to compile Ruby with yjit enabled, but once that Ruby is built, I wouldn’t expect you to need it anymore.
isn't it used to compile the jitted code?
Nope, that’s what yjit does. It produces machine code from Ruby, it does not transpile Ruby to Rust and then invoke rustc, I can assure you that would be far too slow.