Even mild herbivory on a large, healthy tree can adversely affect the health of the tree. The tree may not be able to compensate for its loss of nutrients, thus it suffers a loss in overall health. This small reduction in the overall biomass of the tree can be handled relatively efficiently with minimal cost to the tree. It is a large reduction in the biomass of the tree that needs to be avoided. That is where secondary compounds come in to play.
Secondary compounds have a variety of ways of discouraging herbivory.
The most obvious way to discourage an organism from consuming a substance is to make the substance taste bad, in effect, stopping herbivory before it gets out of hand. The bitter taste of tea is due to the secondary compounds found in the tea leaves, thus leading some people to find the taste of tea truly disgusting. As with all substances, some people are more affected than others, depending on genetics, tolerance, and use. This has led to the proliferation of all types of pesticides to discourage herbivory. Caffeine and morphine operate in this manner.