I approach RPGs, both online and tabletop like I do writing fiction in general.
An RP should always have a defined 'goal' or 'end' that things are working toward, as every good story needs an ending, and the Player Characters are the agents of that story and their actions should drive it forward.
Of course, RP and RPGs are different from (most) other types of storytelling because the plot advancing is resting on the actions of the players as much as the 'author', the GM, who wrote the story.
'how long' it should last is a difficult question. I think it depends on how your plot is structured and what events you want to include. I tend to plan around smaller arcs that feed into a bigger plot, and that with the end of each arc, the players discover something that will help them get a grasp of the larger scale, and bring them more into the spotlight of events. Each arc is an adventure, focused around one or two major locations, and also usually spotlights one characters' background and their plot more than the others, so everyone gets a chance to be the 'star'. The arcs will also increase in the level of drama, tension, and higher stakes as the players advance through the plot.
Usually that's about 3-5 arcs and then a climax and a resolution/Epilogue/Denoument.
In tabletop terms, that's usually about 2-3 session per adventure, depending on the length of the session, and of course, the time OOC it takes depends wildly on how often you meet up to play.
Online, it depends how quickly the game moves, which is reliant hugely on how often people can post.