Here is the answer to the Question . Our tweets are posted in a fraction of second ,but actually a lengthy process is involved .
To help explain
the importance of the JVM within the Twitter infrastructure, here is a
high-level overview of the primary ways in which the JVM affects an average
Tweet as it is set loose into the Twitter sphere:
1. A popular
fashion pundit seesa Best Actress nominee emerge from her limousine on the evening
of the Academy Awards. She types her impressions into a Twitter app on her
smartphone: “Glamorous Jennifer Lawrence
approaches red carpet in white Dior gown evoking old Hollywood.#OscarsFashion2013.” Her Tweet is
geotagged with geographical metadata noting the location.
2. After she hits
the Tweet button,her message is sent to Twitter’s
front-end
routing and load balancing tier, which is written in Scala and runs on the JVM.
The front-end system communicates with Twitter’s business tier, which also runs
Scala, to authenticate the user and verify that her incoming Tweet conforms to
the site’s business rules.
3. The Tweet
enters an asynchronous pipeline that will end up delivering it to the caching
and storage tiers. Once the Tweet enters this pipeline, the system sends back a
reply informing her that her Tweet was successfully posted. In the background,
the Tweet is then delivered to all the users who follow this popular fashion
authority.
4. Next the Tweet
enters Twitter’s relevance pipeline, which determineswhat it is about and who will
be interested in it. Relevance is based not only on followers, but also on
information within the Tweet: who the sender is, where it was sent from
(geotag), and the hashtag that categorizes Tweets by keywords.
5. A Java program
in this pipeline recognizes that the hashtag #OscarsFashion2013 is being used
on a large number of Tweets and adds that hashtag to Twitter’s trending topics.
Instantly, Twitter users around the world see #OscarsFashion2013 as a topic of interest
and can send or receive Tweets with that hashtag.
6. When another
fashion minded user sees the rending #OscarsFashion2013 hashtag, he or she can
click on itwhichresults in a Scala program retrieving the Tweet from the cache
or storage tiers