Anesthesiologists need 8 years of post-graduate study - 4 years of medical school, 1 year of internship and 3 additional years of residency (most programs combine the internship and the rest of residency into a single coherent curriculum these days)
Compared to entering a career in software straight out of undergrad, being a doctor takes a while to pay off. It takes even longer to pay off if you consider dollars per hour worked rather than dollars per year elapsed. For example, at the particular residency my wife is at, she works 1.5 to 2x as many hours as I do as a software engineer, while receiving less than half the pay. I should add that there's nothing exceptional about the number of hours either of us work or our pay.