Features
Phở Networks is an open source framework to build graph apps. Graph apps are based on the archetypes Actor, Graph, Object. You may extend them for a completely custom social application experience. The stack is designed to be infinitely scalable, event-driven, and extensible .
Brought to you by a team of early social networking veterans who experienced the pains of explosive growth, Phở Networks is the first social backend product that is:
- Lightning-fast thanks to its RAM-first design
- Based on the Graph Model
- Auto-scaling
- Open Source + Event-based = Unlimited Extensibility
For more information on Phở vs. traditional methods (such as NoSQL databases) check out the Comparison table.
Lightning-fast thanks to its RAM-first design
All social app solutions to date have been constructed with filesystem as the first point of touch for any data generated by users or the software. Given hard drives’ notorious slowness, the data is always stored in memory as well. That process, called “caching”, makes reads 5 to 20 times faster compared to solid-state and other types of hard drives.
Phở Networks is the first of its kind that is designed in a way the data is stored in RAM first, then copied to hard drives at desired intervals. This eventually persistent model enables the platform to run on minimal hardware while making the application extremely fast.
Social networking data, by design, is not mission critical and a few seconds to a few minutes data loss is acceptable. Phở’s eventually-persistent model offers the system operator to fine-tune a fine balance flexibly between the number of servers they’d like use to support the operations and the amount of time a worst-case scenario of data loss may be tolerated.
Moreover, Phở takes advantage of the latest paradigms in networking, e.g. event-driven non-blocking I/O, and renders responses faster than anything you’ve seen before.
Based on the Graph Model
Pho-Kernel is a first of its kind backend. It is not a database but it is closely coupled with Redis, a proven distributed persistable in-memory storage service. Moreover, Phở stack gives you a familiar programming interface for graph-type relationship models that are in heavy use with social-enabled apps.
Phở introduces GAO to model social graphs. Nodes and Edges are atomic entities of any graph. In the GAO model, the atomic nodes are:
- Graph
- Actor
- Object
Phở Networks allows you to extend these abstract entities with your own, and create a new social network, or use one of our existing recipes to replicate well-known solutions for your own domain-specific community needs.
Here’s an example:
# pho-graphql-v1
type Tweet implements ObjectNode
@edges(in:"User:Post, User:Like, User:Consume", out:"Mention")
@permissions(mod: "0x07555", mask:"0xfffff")
@properties(expires: 0, editable: false, volatile: false, revisionable: false)
{
id: ID!,
content: String! @constraints(maxLength: 140),
create_time: Date! @now
}
Once the schema is defined, the Phở Networks engine compiles them into interpretable PHP files ready to query via REST or access programmatically.
Auto-scaling
To date, database sharding and replication have been the de-facto methods of scalability in the social networking world. While they are reliable, database sharding requires an enormous amount of maintenance to make sure the systems function safely and as expected.
Phở Networks does not depend on any of these archaic methods, and it is horizontally scalable simply by adding new commodity hardware that runs the same piece of software on each machine. This makes scaling super-easy, super-fast.
While designing Phở Networks, our aim was to build a truly infinitely scalable open source fully extensible social backend. The biggest challenge was database. Today's popular databases such as MySQL are hard to maintain with growing traffic and millions of daily active users. The answer to these problems are (a) to shard your data (b) to switch to a NoSQL solution. Although sharding data is tedious and expensive, and NoSQL solutions are notoriously yet to standardize and stabilize. In response, inspired by FriendFeed founder Bret Taylor's schema-less MySQL blog post, we chose to create a stack that would be built upon stable technologies and use atomic methods to establish a horizontally scalable platform to handle any workload.
At Phở, our default choice of stable keeper of truth has been Redis. Although this and all of our choices can be adapted to your platform of choice using custom adapters. For indexing, we use Neo4J. For event-driven messaging, we use ZeroMQ. The platform itself is therefore clusterable to an endless number of machines using round-robin DNS techniques and high-availability solutions that continuously listen for service heartbeats.
The technologies in use by Phở Networks have been field-tested by social networking giants such as Twitter. For example, one of the components that’s used for simple round-robin database queries is called Twemproxy by Twitter.
Open Source + Event-based = Unlimited Extensibility
Last but not least, Phở Networks’ event-based design allows you to plug your custom functionality into any part of the system via hooks and signals. Besides, Phở is open source. Which means, you can view and modify the source code too.
Phở Networks stack is not monolithic. Its architecture is based off of microkernel principles which makes each part of the stack stand on its own repository, decoupled from services. This approach makes the Phở Networks source code easier to grasp and play with for programmers.
Comparison
Foundation | Maturity | Scalability | Convenience |
---|---|---|---|
Relational Database | 10 | 3 | 6 |
NoSQL | 8 | 8* | 6 |
Graph Database | 6 | 3 | 4 |
Phở | 3 | 10 | 10 |
* there is no major SN that uses mongodb (to the best of our knowledge) but they all use redis and memcache in one way or another
Any questions/comments? Please say below: