Manuscript illustration of the Battle of Kurukshetra
Traditionally, the authorship of the Mahabharata is attributed to Vyasa. There have been many attempts to unravel its historical growth and compositional layers. The oldest preserved parts of the text are thought to be not much older than around 400 BCE, though the origins of the epic probably fall between the 8th and 9th centuries BCE The text probably reached its final form by the early Gupta period (c. 4th century CE). The title may be translated as "the great tale of the Bhārata dynasty". According to the Mahabharata itself, the tale is extended from a shorter version of 24,000 verses called simply Bhārata.
The Mahabharata is the longest known epic poem and has been described as "the longest poem ever written". Its longest version consists of over 100,000 shloka or over 200,000 individual verse lines (each shloka is a couplet), and long prose passages. About 1.8 million words in total, the Mahabharata is roughly ten times the length of the Iliad and the Odyssey combined, or about four times the length of the Ramayana. W. J. Johnson has compared the importance of the Mahabharata in the context of world civilization to that of the Bible, the works of Shakespeare, the works of Homer, Greek drama, or the Qur'an.
Krishna and Arjuna at Kurukshetra, 18th-19th-century painting
The epic is traditionally ascribed to the sage Vyasa, who is also a major character in the epic. Vyasa described it as being itihāsa (history). He also describes the Guru-shishya parampara, which traces all great teachers and their students of the Vedic times.
The first section of the Mahabharata states that it was Ganesha who wrote down the text to Vyasa's dictation. Ganesha is said to have agreed to write it only if Vyasa never paused in his recitation. Vyasa agrees on condition that Ganesha takes the time to understand what was said before writing it down.
The epic employs the story within a story structure, otherwise known as frametales, popular in many Indian religious and non-religious works. It is recited by the sage Vaisampayana, a disciple of Vyasa, to the King Janamejaya who is the great-grandson of the Pandava prince Arjuna. The story is then recited again by a professional storyteller named Ugrasrava Sauti, many years later, to an assemblage of sages performing the 12-year sacrifice for the king Saunaka Kulapati in the Naimisha Forest.
Modern depiction of Vyasa narrating the Mahabharata to Ganesha at the Murudeshwara temple, Karnataka.
The text has been described by some early 20th-century western Indologists as unstructured and chaotic. Hermann Oldenberg supposed that the original poem must once have carried an immense "tragic force" but dismissed the full text as a "horrible chaos." Moritz Winternitz (Geschichte der indischen Literatur 1909) considered that "only unpoetical theologists and clumsy scribes" could have lumped the parts of disparate origin into an unordered whole.
(source)