The psalms do not portray a sugar coated version of Christianity, they shows us what it means to be a follower of Jesus Christ in the nitty gritty of life. Psalm 3 was not written in a cosy armchair, it was written in the epicentre of disaster.
David had lost everything: his throne, his reputation, his friends, his family. Even his life was on the line, yet rather than panicking, David clung to God. His life may have been turned upside down, but his God never changed.
Psalm 3 shows us how the believer can enjoy God's peace even amidst the painful storms of life.