views:

207

answers:

7

Hey
How can we make a dynamic website or a website which is developed in PHP and backend as MySQL a Social Networking Site High Scalable?

+1  A: 

Before you make it highly scalable, make sure it's highly available. Redundancy in everything is key. Multiple servers, multiple sites, multiple everything!

stillstanding
Dont Understand, can u detail it?
Alex Mathew
This might enlighten you: http://en.wikipedia.org/wiki/High_availability and http://en.wikipedia.org/wiki/Fault-tolerant_system. You can plan for a scalable system but if it fails every now and then, it's useless.
stillstanding
+1  A: 

Memcached

DanSingerman
Memcached is a good option?how scalabe it is?
Alex Mathew
How scalable is it? Well Facebook use it.
DanSingerman
+1  A: 

Worry about scaling when you need to worry about scaling, not before. At that point you should know the answer or be able to hire someone who does.

Let me attempt to clarrify this answer a little.

Scaling is a fairly convaluted term in modern development because very often "best practices" such as using design patterns, frameworks, database abstraction, and normalization are the root cause of bottlenecks which limit scalability in extremely demanded websites.

Throwing hardware at software will basically allow you to scale anything to a point.

At that point (where you need to throw more hardware at the problem) you most likely have enough of a user base that you either are making money off of your website/service or in the case of an open source product you'll likely have a following. These resources will provide you access to higher level computer scientists/engineers which can help with scaling.

Scaling at the level of reducing stress on hardware becomes very anti-"best practices". You begin writing code to do very specific tasks quickly. Take twitter for example, they've basically rewritten twitter to no longer use ruby on rails, but instead use scala and designed twitters already successful features around performance alone. Facebook on the other hand has written custom PHP packages in order to compile PHP.

evolve
I disagree with this. Even if they don't make it highly scaleable from day one, they at least need to give some thought to the design of the software such that it can be made to scale, should it ever be required. There is a vast difference between premature optimisation and good design.
DanSingerman
"Premature optimisation is evil" is dogma to some people on here :-/
DanSingerman
It might not be easier to scale a product after it is already live, however now-a-days you can always just throw hardware at it until you redevelop it to scale properly. Famous examples: twitter, facebook (to some extent). Basically preemptive scaling could be considered a waste of time and resources for startups. (I'm not saying I agree with what I'm writing, I'm just stating the facts).
evolve
@evolve I guess it's about diminishing returns: you shouldn't waste huge amounts of time making an unused site highly scaleable, but you should put some design effort into planning how you could scale it. Not even thinking about scaling in an effort to deliver v1 is wrong for me. As is polishing your scaling to an extent that significantly delays v1.
DanSingerman
@DanSingerman clarified my answer a little, I think you might find it a little more to your liking.
evolve
+3  A: 

Look at the infrastructure of sites like facebook, twitter and youtube on High Scalability. They give you a really nice overview of tools that are out there (most of them are open source and free).

You should probably look into:

  • Reverse Proxying/Load Balancing (squid or varnish)
  • Data caching (memcache and memcached)
  • Possible backend in c++
  • NoSQL (Cassandra, CouchDB, MemcacheDB)

I wrote a post on the topic a couple weeks ago if you're interested, check it out here.

Ken Struys
@Ken : thks for the links and info
Alex Mathew
@Alex np let me know if you have any questions about setting things like this up.
Ken Struys
+5  A: 

Following good design and programming practices such as low coupling. Try finding the best solution for your site (design patterns, OO best practices) with scalability in mind.

I don't think there's any silver bullet here, it depends on each case.

Redundancy is quite important too as stillstanding says.

Still, first focus on making the best design possible, and when the time comes, worry about scalability.

Fernando
I was just writing nearly the same thing. Glad I reloaded the page before posting. Having loose coupling from your app to potential bottlenecks can help to make the transition from a smaller app to a bigger one much easier.
spinon
+1  A: 

That is like asking how to build a skyscraper, the answer is complicated and depends on a lot of things.

But these questions and suggestions should help a lot.

Diagram out your system design. Create Logical Partitions for Services, that can be split over multiple services. Create multiple virtual host names for services that can be logically split, like static image hosting. Determine which services need to be persistent over multiple requests and develop a session location and caching system.

Learn about MemCached!

Put SQL Caching in front of your sql requests.

Start thinking about "the cloud" - consider creating "disconnected" virtual images that can talk to each other, and exchange all state information in a structured way, that is server agnostic. When you get this right, you can add more cloud servicing transparently, if you get the design right.

George Lambert
+1  A: 

As has been mentioned, scalability of an application depends on many factors. Some options may be application dependent, but proper planning is always important from the start.

There are two types of scaling, vertical and horizontal. Vertical scaling is the old "throw more hardware at it" approach, meaning upgrade the server processor and/or memory. Horizontal scaling is the proper way to scale, by adding redundancy and spanning resources across multiple servers. Usually when people talk about scaling, they mean horizontal scaling.

A typical Web architecture for scaling requires at least one load balancer, two or more Web servers, and one or more database servers. Each layer scales independently, and has to be handled differently. For example, you might add more load balancers to make the site more highly available (so if one balancer fails, the others are unaffected); this layer shouldn't require changes to your application, but will require other changes to your DNS and Web server software. Conversely, adding database servers may add to high availability, increase response times, or both. Changes to the database layer will probably require changes to the application so it can split reads and writes across multiple servers.

Of course, there are many other tools which may be used for scaling and/or high availability. Examples include application level caching (memcached), HTTP accelerators (basically HTTP level caching), and alternative data storage methods.

The best thing to do is keep these things in mind when planning and building the foundation of the application. Will it need to read and write from different database servers eventually? How are sessions stored, on the local filesystem (not scalable) or in a central cache (scalable)? Can these data objects be cached and if so, for how long before they are too stale? If you pay attention to these main things, most of the time your application will be able to scale without much additional work to the code base.

Ryan Chouinard