2 Samuel 22; Psalm 18
This psalm of David appears in both 2 Samuel 22 and Psalm 18, which he wrote at the time of his deliverance from Saul, and his enemies. This would have been written about the time that he was named king in Judah, when he was 30 years old.
It is a good thing to give thanks to the Lord for all the things He has done for us, and to take time to recall His righteous acts on our behalf, just like David was in the habit of doing. How many times does the Lord deliver us from great difficulties, and we forget to give Him praise and thanks?
It was at 30 years of age that David transitioned into His God given role in Israel, and it was at 30 years of age that Jesus likewise left His private life to fulfill His public ministry in the world.