Marshalling and Unmarshalling

Marshalling is transforming the object into a byte stream for storage or transmission, in ruby when we push a object to redis for Sidekiq to fetch and process we use marshalling.

2.7.2 :004 > marshaled = Marshal.dump('this is an object')
 => "\x04\bI\"\x16this is an object\x06:\x06ET"

Now when the Sidekiq starts processing the job then the data is fetched from the redis in byte stream and converted back to ruby object.

2.7.2 :006 > Marshal.load(marshaled)
 => "this is an object"