Variational Approach to Hydrodynamics - from QGP to General Relativity