Their venom is like the venom of a snake, like that of a cobra that has stopped its ears, that will not heed the tune of the charmer, however skillful the enchanter may be. - Psalm 58:4-5
According to Jewish tradition, one day King David saw a flea attack a spider and then saw a madman chase them both away. David asked God, "Why did you create these three creatures in the world? They serve no purpose. The flea simply bites people; the spider weaves, but we do not wear its web. The madman causes damage to others and does not know Your Greatness. What benefit is there for them in this world?" God answered, "David, a time will come that you will need all three and you will see their purpose."
Indeed, David did discover for himself the purpose of all three, which we can see in the verses of his psalms.
In Psalm 56, David recalled the time when he had been captured by the Philistines, who wanted to kill him. In that episode, David saved himself by pretending to be a madman. The king believed that David wasn't really David, so he let David go and spared his life.
In Psalm 57, David recounted the time when he was hiding in a cave from King Saul, who was out to kill him. Saul came across the cave, but God had sent a spider just moments before he arrived to spin a large web over the entrance to the cave. Seeing the web, Saul reasoned that no one could possibly be inside the cave, so he let his guard down and went inside alone to relieve himself. David had an opportunity to kill his opponent, but instead he cut off a piece of Saul's cloak to prove to Saul that he had no desire to harm him.
According to the Jewish sages, in Psalm 58, David had another encounter with Saul and his general, Abner. Apparently, Abner felt that David's action in the cave was an insult against him for not protecting Saul effectively, so Abner made up lies about David and spoke "venom" that poisoned Saul against David once again.
David then had another chance to kill Saul when Saul and his men were fast asleep. David was able to crawl under Abner's bent legs and get to Saul. He took Saul's spear to prove that while he could have killed Saul that was not his intention. As David turned to leave, he saw that Abner had straightened out his legs and there was no way to exit undetected. At that very moment, God sent a flea that bit Abner's ears, causing him to stir in his sleep and bend his legs again, allowing David to escape safely.
God showed David how every detail of His world has significance and is essential in His overall plan. That includes the things that we don't deem very valuable and the people who we think we could do without. Each of us is an indispensable piece of His puzzle, and we must do our part to contribute to the perfection of His world.