Dukkha (Pāli; Sanskrit: duḥkha; Tibetan sdug bsngal) is a Buddhist term commonly translated as "suffering", "stress", "anxiety", or "dissatisfaction". Dukkha is identified as the first of the Four Noble Truths.
Within the Buddhist tradition, dukkha is commonly explained according to three different patterns or categories. In the first category, dukkha includes the obvious physical suffering or pain associated with giving birth, growing old, physical illness and the process of dying. These outer discomforts are referred to as the dukkha of ordinary suffering (dukkha-dukkha). In a second category, dukkha also includes the anxiety or stress of trying to hold onto things that are constantly changing; these inner anxieties are called the dukkha produced by change (vipariṇāma-dukkha). The third pattern or category of dukkha refers to a basic unsatisfactoriness pervading all forms of life because all forms of life are impermanent and constantly changing. On this level, the term indicates a lack of satisfaction, a sense that things never measure up to our expectations or standards. This subtle dissatisfaction is referred to as the dukkha of conditioned states (saṃkhāra-dukkha).
Neither pessimistic nor optimistic, but realistic
The central importance of dukkha in Buddhist philosophy is not intended to present a pessimistic view of life, but rather to present a realistic practical assessment of the human condition—that all beings must experience suffering and pain at some point in their lives, including the inevitable sufferings of illness, aging, and death. Contemporary Buddhist teachers and translators emphasize that while the central message of Buddhism is optimistic, the Buddhist view of our situation in life (the conditions that we live in) is neither pessimistic nor optimistic, but realistic.[a]
Walpola Rahula explains the importance of this realistic point of view:
First of all, Buddhism is neither pessimistic nor optimistic. If anything at all, it is realistic, for it takes a realistic view of life and of the world. It looks at things objectively (yathābhūtam). It does not falsely lull you into living in a fool's paradise, nor does it frighten and agonize you with all kinds of imaginary fears and sins. It tells you exactly and objectively what you are and what the world around you is, and shows you the way to perfect freedom, peace, tranquility and happiness. One physician may gravely exaggerate an illness and give up hope altogether. Another may ignorantly declare that there is no illness and that no treatment is necessary, thus deceiving the patient with a false consolation. You may call the first one pessimistic and the second optimistic. Both are equally dangerous. But a third physician diagnoses the symptoms correctly, understands the cause and the nature of the illness, sees clearly that it can be cured, and courageously administers a course of treatment, thus saving his patient. The Buddha is like the last physician. He is the wise and scientific doctor for the ills of the world (Bhisakka or Bhaisajya-guru).
Surya Das emphasizes the matter-of-fact nature of dukkha:
Buddha Dharma does not teach that everything is suffering. What Buddhism does say is that life, by its nature, is difficult, flawed, and imperfect. [...] That's the nature of life, and that's the First Noble Truth. From the Buddhist point of view, this is not a judgement of life's joys and sorrows; this is a simple, down-to-earth, matter-of-fact description. 
The Buddha acknowledged that there is both happiness and sorrow in the world, but he taught that even when we have some kind of happiness, it is not permanent; it is subject to change. And due to this unstable, impermanent nature of all things, everything we experience is said to have the quality of duhkha or unsatisfactoriness. Therefore unless we can gain insight into that truth, and understand what is really able to provide lasting happiness, and what is unable to provide happiness, the experience of dissatisfaction will persist.[web 4]