For the historical occasion mentioned, compare 2Sa. 15:1-17:29. David, in the midst of great distress, with filial confidence, implores God's aid, and, anticipating relief, offers praise. (Psa 3:1-8)
Lord . . . increased--The extent of the rebellion (Sa2 15:13) surprises and grieves him.