Ever wonder why some people get the jitters after a cup of coffee, while others can down a double-espresso right before bed and sleep soundly through the night? The explanation may have to do with your genes, according to research. 

What's more, the findings may also shed light on whether or not coffee is truly good for your health. Some studies have found benefits, while others warn of potential risks. Just last month, the World Health Organization reversed its decades-long stance that the beverage is "possibly carcinogenic," citing a lack of evidence. Java junkies rejoiced. Yet it's still unclear: Is a coffee habit good for you?

RELATED: How to Make Cold Brew Coffee

It turns out the answer isn't so simple, according to a report in The New York TimesAbout 10 years ago, Ahmed El-Sohemy, PhD, a professor of nutritional sciences at the University of Toronto, decided to look at a particular gene, called CYP1A2, involved in the metabolism of caffeine, and how it might affect coffee's impact on the heart.

People who inherit two copies of the "fast" variant of CYP1A2, one from each parent, are known as "fast metabolizers," and can break down caffeine about four times more quickly than folks who inherit two copies of the slow variant of CYP1A2. 

In a study done with 4,000 adults, El-Sohemy and his colleagues found that consuming four or more cups of coffee per day was associated with a 36% increased risk of heart attack. But once the researchers accounted for the gene variants, they found that the increased risk only applied to the slow caffeine metabolizers. Among the fast caffeine metabolizers, people who drank up to three cups of coffee a day had a lower risk of a heart attack.

RELATED: 6 Health Benefits of Coffee

El-Sohemy says that caffeine may be more likely to trigger cardiovascular problems in people who metabolize caffeine slowly because the stimulant stays in the body longer. Meanwhile, fast caffeine metabolizers get the perks (so to speak) of the beneficial components of coffee (like antioxidants and polyphenols) with fewer adverse effects from caffeine

Other research has produced similar results. In 2009, a group of Italian scientists found that slow caffeine metabolizers with moderate to heavy coffee consumption were more likely to suffer from high blood pressure than fast metabolizers. Among fast caffeine metabolizers, the more coffee they drank, the lower their risk of hypertension.

But as Marilyn Cornelis, PhD, of Northwestern University's Feinberg School of Medicine, pointed out to the Timesit's not all about your CYP1A2 status. There are many genes that are part of the caffeine metabolism process.

RELATED: Should I Cut Back on Coffee?

Researchers are just beginning to investigate the links between coffee metabolism and other health conditions like breast and ovarian cancer, type 2 diabetes, and Parkinson's disease.

For now though, it's helpful to have a better understanding of why a Frappuccino may leave you frazzled—​or why you might require at least two "red eyes" to get going in the a.m.