Sunday, 19 February 2017

Techniques for Solving C10K Problem

The C10K problem is the problem related to optimization of network sockets when it comes to the handling a plethora of clients on a server at the same time .The concept of C10K was introduced by Dan Kegel in 1999 . C10K stands for “handling ten thousand clients on a Gigabit Ethernet connection at the same time”.For efficient output, it is very important that connections should be scheduled in efficient manner. So too be very precise, C10K problem deciphers server’s inadequacy of scaling 10,000 clients due to resource debilitation. Servers usually follow thread per client model. Servers get befuddled when pooled threads take gigantic time on blocking the operations. Operating system normally allocates 1MB for implementation of native threads. As a result, scalability can easily be affected by depleting server’s CPU with too much context switching

Techniques for CK10 Problem

There are certain techniques to handle C10K problem which are as follow.

  1.             Event driven Input
  2.       Scaling Node technique
  3.       Server default configuration technique
For dealing with event driven I/O, server usually works in single threaded mechanism. For listening new events, we generate single event loop. This loop handles the data in and data out mechanism in well apt manner. This approach really helps to cater concurrent connections running on server. In Linux systems, it is dependent on epoll () which is the mechanism for event notification.The main responsibility of epoll () is to keep tracking the multiple file descriptors to analyze any possibility of I/O . Single threaded solution is easy to code because in multiple threads, we usually come across the issues like race conditions. Event driven approach is of significant importance in reducing the CPU’s usage of used applications. This really helps the modern hardware to achieve more energy, and torridity saving. All these aspects really help to counter C10K issue. Nginx web/proxy server is the prominent example of event driven mechanism, and it is much easier as compare to web servers such as Apache. The Nginx is well known for stability, low resource consumption, and for high performance . In modern era, libAttachedSQL is also following the event driven I/O but are doing at client side. This really helps the client applications to handle many clients on single thread in well apt manner


The Scalability means the capability of the request to achieve the performance related goals under intense load . The C10K problem provides the path to achieve the key design goal as far as designing the modern applications are concern like Nodes. Nodes are basically designed to implement the scalable applications that helps to cater the CK10 problem. So, here main motif is to create toolkit from these nodes connected through standard protocols. 10MB memory is allocated to each new node .There are two major scaling which are as follow.
*      Horizontal Scaling
*      Vertical Scaling


Horizontal scaling basically reciprocates to the load by incrementing or decrementing the network resources.


Vertical scaling deals with the increasing the single server’s capability of   handling mammoth load such as storage space etc. The scalable node technique is actually the utilization of both horizontal, and vertical scaling techniques either in batch, or individually. TheYouTube, scalable application that deals with billions of request by using MYSQL, Apache, and Python programming language. Facebook is also highly scalable application that deals with millions of requests at the same time

 Server Default Configuration Technique


In modern era, tools like Nginx, Python; MySQL, Apache, and PHP have phenomenal job in deal with large number of clients at a same time. So there is no need to redesign the intrinsic nature of all these applications to handle the large traffic in well apt manner. All required is to combine all these tools, and configure the servers by default mode to produce even more effective results as far as dealing with C10K problem is concern. Every web application constitutes of two parts. Static, and dynamic part. Key role of dynamic part is to deliver the pages in assembled manner, and represent that in the form of content.The static portion constitutes of serving files. Both these parts are independent from each other. It is important to note that dynamic portion takes more CPU cycles. Nginx suits to deliver static files, and platform like WordPress deals the dynamic part in efficient manner.

The WordPress plugin can be used for editing the images. The server in the backend always resizes the images into small ones that is appropriate enough to be appealing. Non-technical user uploads a picture into the website through mobile phone generally have no idea images of range 2-6MB are usually burden for servers. The WordPress plugin, by default, resizes the image into kilobytes with high quality. If user wants to resize 6MB file then he/she will have to accommodate the settings to do this job. This is where default mode ameliorates for quality performance.

The WordPress makes gigantic decisions for the user on just one click install. To achieve desired results, we opt for best database, web server; Operating System, but still we can’t configure in apt manner to deal with C10K. This is why it is very high time to have opinionated, and stalwart defaults. If the servers are on by default then it will make sure of most of the RAM, and CPU. This will really facilitate the casual user to enjoy the technology. Moreover, it will adhere the C10K issue in more phenomenal manner. So all require is to make all these configurations the default to cater C10K issue in more compact manner

No comments:

Post a Comment