Now I know maps often don't tell much of a story, but sometimes they do. If you look at a maps of the Byzantine Empire, over the course of its history it seemed to me that it was never quite secure. At various times it lost territory (substantial amounts of territory) to Bulgarians, Persians, Arabs, Lombards, the Huns, Turks and allsorts.
Was it in a constant state of insecurity as it seems, or was it in fact more secure than maps would have you believe? It lasted 1,000 years, much more than most empires but it seems to me it was hanging on by the skin of its teeth a lot of the time. Accurate?
Not accurate.
Right, by the numbers. The Byzantine state had its first brush with extinction in the 480s, during a brief civil war between Zenon and Basiliskos. Window was maybe five years or so, and it honestly would've taken a
lot for things to spin out of control at that point
1. Even the invasions of Attila's Huns in the 440s never posed an existential threat to the Empire. For most of the rest of the time between the Byzantine state's inception and the death of Maurikios (602), the Empire was a superpower, with no rivals save the Sasanian Empire, and the Sasanians never posed an existential threat to the Byzantine state. (Except for a few years in the 610s and 620s. But we haven't gotten there yet.) For a good deal of
that time, the Empire was territorially expanding (not a particularly good measure of military power or stability, but whatever) in Italy, Africa, and Armenia; in 565, the Byzantine state hit a territorial zenith, and it hit another peak in 602 despite the Lombard invasion, conquering much of the Caucasus and driving Avars and their Slavic meat puppets out of the Balkan territories of the Empire. So, total of "the Empire is potentially screwed" moments for 284-602: about five years.
From 602 to 628, the Empire was embroiled in an apocalyptic war with the Sasanian Empire and the Avar Qaganate, but initially it didn't seem like it was in danger of collapse (even the initial Sasanian advantage was chiefly due to a civil war in the Empire and the revolt of most of its eastern armies); only when Herakleios seized the throne from Phokas and started losing control of the Levant and Egypt did things start to go pear shaped. I'd call the Empire's position precarious from 615, when Slavs attacked Thessalonike, while the Sasanians had control over the Levant, Egypt, and parts of Anatolia, to 626, when Herakleios' campaigns in the East started to really turn the tide, while the Avar-Iranian siege of Constantinople was beaten back. The Empire won the war with the Sasanians, in part due to the Iranian empire's own instability, and was almost immediately invaded by Muslim Arabs. From perhaps 640, when much of Egypt was conquered, to 717, when the last real siege of Constantinople was beaten back, the Byzantine state was in more or less serious danger of collapse, first from intrigues after the death of Herakleios, and then from further civil wars stemming from military reforms to decrease military expenditure - all combined with Muslim pressure on the frontiers, and steadily attenuating territorial possessions. So, total for 602-717 is something like 88 years. This was the Empire's worst period of crisis for centuries.
After 717, the Empire was more or less on a stable footing, but was unable to make serious offensive gains anywhere for several decades. Even though its frontier defenses against the caliphates - first the Umayyad, then the Abbasid - were able to be penetrated, all of the Muslim campaigns were nearly-regularized raids, not existential threats. In the 780s, the Empire started to expand again and cleaned up a nasty internal religious controversy around Iconoclasm
2; from the 840s, further military and fiscal reforms
3 and the effective end of the Abbasid caliphate as a powerful state capable of offensive warfare ensured the security of its eastern frontiers. Territorial expansion was more or less steady from the late ninth century into the eleventh century, backed up by the Byzantine tenth-century military renaissance. Dramatic territorial conquests were made under the Emperors Nikephoros II Phokas (963-969) and Ioannes I Tzimiskes (969-976). At the same time, serious internal fissures and the militarization of the state meant that, despite being at a territorial peak unseen since the reign of Herakleios, the Empire was also skating on the edge of disaster. Much of its military power was soaked up in fratricidal civil wars. Ioannes Tzimiskes led the Empire to the brink of reclaiming the entirety of the Levantine possessions and - potentially - even Egypt, but his policies of
government created a militaristic monster that almost destroyed the Empire after his death, with twenty long years of destructive civil war. When it was all over, though, Basileios II Boulgaroktonos (976-1025) created the powerful foundations of a state that had no military rivals, a ring of surrounding vassal states that added even more to its combat power, a strong economic foundation, and every prospect of surviving as a powerful state for a long time. So, being generous, the total of years that the Byzantine Empire spent under serious duress and threat of collapse during its so-called apogee (717-1025) was during the civil wars of the Skleroi and the Phokades from 976 to 989, a total of thirteen years - demonstrating that borders and map changes aren't always the best guide to the stability and survivability of the state.
After 1025, the Emperors consistently sucked, demonstrating a truism of any state before the early modern era: any monarchy could develop a run of
really bad luck and cease to exist. There's really no reason why, say, France or the Holy Roman Empire continued to exist after the eleventh century, while the Byzantine state attenuated and died. Contingency rules all.

After fifty years of frittering away imperial resources while still remaining a clear superpower, the Empire developed a nasty case of civil war in the 1070s after a minor skirmish at Manzikert, and the various sides started calling in Turks to help them out. The Turks stayed, in a remarkably similar pattern to the destruction of the Western Roman Empire in the fifth century. Unlike the Western Empire, though, the Byzantines managed to initially limit the damage and confined the Turks to the Anatolian plateau, where not a whole lot of people had lived anyway. The state remained powerful after a brief episode of "oh crap we're screwed" from about 1075 to 1091, ish. Still a superpower, still made a lot of conquests, even fiddled around in Italy for awhile (uselessly, but still). From 1025 to 1180, maybe sixteen years were spent on the knife's edge.
Things went pretty badly after 1180. Invariably, expedients intended to solve old, but non-crippling problems created huge problems. Civil war followed on revolt, invasions attenuated Byzantine possessions in Europe and Asia, and in 1204, the Crusaders sacked the capital, taking over much of the core of the Byzantine Empire and fragmenting the remainder. Only in 1261 did the Empire of Nikaia recapture Constantinople, despite easily being the most powerful state in the Aegean for the previous few decades; only in the 1270s did the reestablished Byzantine state gain a measure of real security. It was still clearly the largest and most powerful state in the area, easily able to dominate any one of its many rivals. (The fact that it
had many rivals was more troublesome.) And that didn't last long; by the 1340s, it was utterly gone, squandered in a series of civil wars, worsened by plague, all of which opened the European possessions of the Empire open to Serbian and Turkish invasion. From then on, the Empire wasn't totally doomed, but describing it as "in a constant state of insecurity" would be spot on. From 1180 to 1453, I'd say that 1185-1280 was a period of "constant insecurity" - you know, of those years that the Byzantine state was still alive - and again from 1341 to 1453. That's 207 years of existence on the edge of destruction. Kinda skews things.
Interestingly, the Byzantine state's periods of serious crisis always followed on internal problems, not external ones. It was never simply overpowered by a rival; the Greeks simply fought each other self-destructively, allowing the rivals to waltz in. The civil wars after the death of Maurikios kicked off the Sasanian invasion and the later Arab threat. The civil wars of the Skleroi and Phokades made the Empire potentially breakupable even at a territorial apogee. (The breakup would've been weird, though. It'd have been something like the Mongol expansion: the Byzantine state had a very real chance of
conquering itself to death.) The civil wars of the 1070s let the Turks and Normans in. The civil wars of the 1180s kicked off a Bulgarian revolt, more Turk invasions, more Norman invasions, and eventually the Fourth Crusade. The civil wars of the Palaiologoi and Kantakouzenoi opened the door for the Byzantine Empire's final debilitating bout of weakness.
1 Shameless plug: I'm currently writing an alternate history that stems from two things, one contingent on the other: the Western Roman Empire survives the 460s, and the Eastern Roman Empire expires in the 480s due to this civil war (which gets worse because the WRE survives). It's on hiatus atm while I try to churn out something else for Kraznaya. I would like some more feedback though. 
2 Even the Iconoclast controversy was self-generated; while the theological aspects of it were grass-roots in parts of the Empire's Asiatic possessions, the political clout it achieved was out of all proportion to its actual support within the Empire, due to the patronage of the Armenian emperors of the eighth century and a few emperors in the ninth.
3 In addition, the Empress Eirene Sarantapechaina (regent 780-797, regnant (!) 797-802) spearheaded the creation of an effective civil bureaucracy to underpin her rule, since she understandably couldn't demonstrate her imperial power through the typical, male-centric means of having the image of being a war leader. The civil bureaucracy, which continued to expand due to the growth of literacy (partly an endemic factor, partly motivated by the creation of more schools), remained one of the main foundations of imperial rule into the twelfth century.