What Are the Different Types of Facebook Games?

Friends For Sale originated from the well-known social networking site Facebook. Once launched, this plugin has won the favor of a large number of users. After the popularity of domestic social networking sites began to imitate the trend, the earliest seen in Kaixin.com. There are now social networking sites for trading, including Kaixin.com, Tonglou.com, Tencent QZONE, Renren.com, and 40 million.

Friends trading

(Facebook game)

Friends For Sale originated from famous social networking sites
Friends Trading originated from Facebook (an international SNS website)
Not Kaixin

2.1 Friends Trading 2.1 Basic Introduction

Official name: Friends For Sale!
Chinese translation: friend trading, friend trading
In the short period of three months that the friend buying and selling plug-in appeared, friend buying and selling became the top ten applications for facebook. It processed 200 requests per second and generated 300,000,000 page views per month. Technically, I chose the Ruby on Rails framework, two part-time programmers, a dozen servers, and an excellent architecture.

2.2 Friends Trading 2.2 Application Architecture

l Ruby on Rails
l CentOS 5 (64bit)
Capistrano upgrade and restart the application server
l Memcached
l Mysql
l Nginx
l Starling distributed queue service
l Softlayer bastion host
l Pingdom Site Monitor
l LVM Logical Volume Manager
l Dr.Nics Magic Multi-Connections Gem database read and write separation

2.3 Friends Trading 2.3 Current Situation

l Top ten popular applications for Facebook
l Nearly 600,000 active users
l 500,000 unique user visits per day and keep growing
l 300 000 000 page view per month
l 300% monthly steady growth rate
l 2100 000 000 unique users last month
l 200 requests per second
5TB of traffic per month
l Two part-time developers (one currently full time), one remote DBA support
l 4 database servers, 6 application servers, a staging server, a front end server
Six 4 core 8G memory application servers
Create 16 mongrels per application server, a total of 96 mongrels

2.4 F&Q Friends Trading 2.4 F & Q

Why do this system:
Doing this system is more to test and understand the Facebook system
When designing a system, what challenges and innovations are there in terms of design, architecture, and implementation?
Because as an application of Facebook, cache pages cannot be used for each request. Therefore, it is a system that is implemented from time to time and has frequent write operations, which requires higher database optimization requirements.
How to meet these challenges?
We use memcached as the middle layer, and each request does not directly access the database. Use Rail's fragment caching to cache the presentation layer.
What is the current size of the system?
Yesterday the traffic was 500,000 unique users and the traffic has been growing. According to statistical feedback, there are 300,000,000 page views this month.
Bandwidth usage
Last month generated 3T traffic, this month at least 5T, the content is just some icons and xhtml / css.
Number of files, number of pictures, and data
There are no documents and there are 10,000,000 users information. Only a few pictures.
growth rate?
Page view has grown from an average of 3M per day to 10M per day a month ago, and 1M a month before, so the average monthly growth rate is 300%, and the average is processing 200 visits per second.
Do users need to pay?
All free
User growth rate
It averages 1% and is growing at a rate of 3% per day.
How many users were active last month?
According to Google's statistics, 2 100 000 unique users visited last month.
How does the system architecture do it?
First, it is built on a very stable Rails cluster, and uses nginx software to run load balancing and static content services. Six application servers use 4-core CPU8G memory. Each application server runs 16 mongrels, for a total of 96 mongrels. Load balancing goes directly to mongrels ports. In addition, a 4G memcache server, a stand-alone server.
Use god to detect progress.
Data layer, using two 32G memory, 4 core CPU, 4 × 15K SCSI RAID 10disk as the master and slave. Use Dr Nic's magic multi-connection's gem product for read-write separation.
More slave servers are now added for higher read efficiency and redundancy.
Owner strategy.
How to plan the architecture
Nothing is done at the application layer because the functionality is very trivial. In terms of databases, we have only one main database, which is distributed as quickly as possible. Divide the database vertically to increase availability.
Is there anything unique you can learn from?
three aspects:
1.Neither developer has done large-scale Rails development before
2. Our growth rate is relatively rare in the history of Rails development.
3. There is almost no caching, each request is directly processed by Rails
What have you learned among you? Why did you succeed? Do you want to do other things in the future? Is there anything you don't want to change?
We know that a good hosting, good hardware, and good DBA are very important. We used to choose Railsmachine, they are a very good space provider but give us great support. Since then, I have hardly encountered any hardware problems, and it took two hours to smoothly switch to Softlayer. Choosing a good hosting is especially important.
Another important thing is that scalable architecture has always been a problem with databases. First check the database. Generally, you can solve it through the database server, database configuration, query, and index.
Start with a good hoster.
We appraised Rails because it is a free and fast-developing program. Practice has proved that the two guys have successfully developed without sufficient time.
How is your team formed?
We have two Rails programmers, including me. And recruited a DBA who used to work remotely.
How many people do you have?
Technically, there are two part-time, one full-time, and one remote office DBA.
Where are you now?
Two full-time personnel remain in the SOMA area of San Francisco.
What do these people do?
As two founders, I first did front-end development and program development. After some experience I also do web management. The founder Alex is very focused on Rails development, and he develops most of the applications. Now I mainly do database work.
What are the unique management methods?
First, find the smartest person, give the best treatment, and do your best. The best management is doing what I do best. I use this method to manage the company. I think I often go wrong here.
How do you make a decentralized team work?
There is a good communication tool. Remote office is more painful. The core development is still local, and some DBA and other things can be remote.

2.6 Friends Trading 2.6 Development

With Rails, Chris Wanstrath's solution is used for many caches, and Dr Nic is used for database connections. We use VIM as the editor.
Development language
Ruby / Rails
Number of servers
12 servers
Server application
4 databases, 6 applications, one staging server, one front-end machine
Custodian
Softlayer
Server operating system
Centos 5 64bit
Web server
Nginx
Database software
Mysql 5.1
Reverse proxy
Nginx
How to deploy
Commissioned Softlayer
storage
NAS backup, SCSI hard disk support.
storage capacity
5TB
How storage expands
Ad-hoc. We don't pay attention to this one, this is our weakness.
Storage server
Nope
How to handle sessions
Database, memcache may be better
How the database is planned
Currently used master-slave. One master and multiple slaves, using load balancing to improve read performance.
How to do load balancing
Nginx
What framework and ajax library to use
Rails
Whether the message service is used
No
What distributed task management system was used
Starling (Queue Management)
How to handle advertising services
Using eCPM
Whether the standard API is used
Nope
How many members of the team
Two developments
Team skills
Me: Front-end development, development (Rails). Recently focused on database and highly scalable Rails development.
Alex: Application development, front-end development, program architecture design.
Development environment
Alex uses OSX, I'm on ubuntu, we use svn for synchronization, I use vim editor, alex uses textmate.
Development progress
Logic layer, test-driven development, and application layer, using iterative development.
Caching strategy
Use memcache no TTL, set expiration manually
Whether client-side caching is used
No

2.6 Friends buy and sell 2.6 system management

How to guarantee performance
Use Pingdom tool for web performance monitoring.
Server and network availability detection
Now we use our own detection tool and the ping detection tool provided by Softlay. Recently we developed FiveRuns as a server monitoring tool.
How to make network and server performance icons
did not do it
How to test the system
We test in modules, and then complete the parts to deploy to the application server.
How to do performance analysis
Analyze each SQL statement to ensure efficiency. There are no test standards.
How to ensure safety
Be careful
Those features need to be improved / maintained
Reflection and criticism. We will be very careful to add some features.
How to do web analytics
Using a growing detection job for virus detection, Google Analytics is also used.
Whether to do A / B testing
Been doing

2.7 Friends Trading 2.7 Related Instructions

System design goals
Support Facebook application-buy and sell friends.
It is based on a volatile financial market.
It is currently one of the top ten popular apps on Facebook.
Tips: Buy and sell friends like pets! You can play with him, give gifts, or show off. A savvy investor will develop his friends into people s goods, in fact this is just to satisfy
How the data center is set up
How to backup and restore the system
LVM, weekly incremental backup, daily basic backup
How to upgrade software and hardware
Do it manually now, unless there is a new application. Use capistrano to upgrade and restart the application server.
How to handle the master database upgrade
Generally, you should first switch to a slave database, and then switch back after the upgrade.
Your development plan
Not very good
Do you have an independent operations team
Hope there is
Whether to use a content distribution system
Nope
Profit model
CPM, browse more and earn more. Profit also through virtual currency.
How to market your products
Word of mouth. Viral MLM.
What is unique about the algorithm
Ruby is already excellent. We just need a simple application.
Whether to store pictures in the database
No, this is not good
What have you done in front-end design
You don't know what will happen until it happens. Once done, you will have complete knowledge to solve the next problem.
Any good or bad things to watch out for
Unreliable hardware, communication difficulties between hosters, the most important thing is to choose a hoster that can support your application. (Sun added: It seems that their operations are all done by idc). Another important thing is how long can commercial hardware do a master-slave setup, and you can easily support 1 billion accesses.
When does the system add new extensions
Without this plan, things are planned before they come.
Is there anything worth developing?
Memcache, you can split your architecture at will
Whether to adjust the architecture in the future
We are going to partition the user database right away, because the database limit will be reached soon.
Facebook marketing ideas
l Facebook successfully digitizes social networks
l Future social relationships are important
Facebook puts fast-growing social relationships on the Internet
l Your application ideas can be: social, seductive, and universal.
l Socialized viral marketing
l Monetization
l generally has potential
l Friends trading is a society because you can buy and sell your social relationships
l It's very interesting because it's just a concept, no stress and a bit of fun
It is fair because everyone is virtual, has a price, and wants to become popular.
l Each application may develop some new users
Calculated from the growth index, each person can affect 1.4 people
l Each user sends a lot of invitations, check announcements, read feeds, view user profiles, and other items
l Each channel can track user clicks, modifications, and uninstalls
Harvest in this section
l Scalability has been a direction of Facebook from the beginning, and they achieved 1,000,000 pv daily visits within a week
l Ruby on Rails is extensible
l Scalability is reflected in architecture, focusing on architecture and operations
l You need a good DBA, a good host, and reasonable hardware
l Use cache and high load hardware, you do not need to do load database optimization
Social relationship is real, it is built on Facebook's user base, and has very good virtual applications.
l Most problems are database, database server, database configuration, query, and indexing.
l Users still try VI

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?