A Comparative Study on Vega-HTTP & Popular Open-source Web-servers

Similar documents
The Advantages and Disadvantages of ITIL

BIG DATA TOOLS. Top 10 open source technologies for Big Data

Cloud Migration: Migrating workloads to OpenStack Cloud

BCP and DR Plan With NAS Solution

Performance Testing. Configuration Parameters for Performance Testing

Delivering Quality in Software Performance and Scalability Testing

Achieving Nanosecond Latency Between Applications with IPC Shared Memory Messaging

Intel DPDK Boosts Server Appliance Performance White Paper

Benchmarking Cassandra on Violin

Informatica Ultra Messaging SMX Shared-Memory Transport

HP ProLiant BL660c Gen9 and Microsoft SQL Server 2014 technical brief

A Packet Forwarding Method for the ISCSI Virtualization Switch

Tempesta FW. Alexander Krizhanovsky NatSys Lab.

Accelerating Enterprise Applications and Reducing TCO with SanDisk ZetaScale Software

Tomcat Tuning. Mark Thomas April 2009

CHAPTER 3 PROBLEM STATEMENT AND RESEARCH METHODOLOGY

The Lagopus SDN Software Switch. 3.1 SDN and OpenFlow. 3. Cloud Computing Technology

Agenda. Enterprise Application Performance Factors. Current form of Enterprise Applications. Factors to Application Performance.

Check Point FireWall-1 HTTP Security Server performance tuning

An Oracle White Paper September Advanced Java Diagnostics and Monitoring Without Performance Overhead

Using MySQL for Big Data Advantage Integrate for Insight Sastry Vedantam

JoramMQ, a distributed MQTT broker for the Internet of Things

GlobalSCAPE DMZ Gateway, v1. User Guide

RevoScaleR Speed and Scalability


CentOS Linux 5.2 and Apache 2.2 vs. Microsoft Windows Web Server 2008 and IIS 7.0 when Serving Static and PHP Content

Scalability Factors of JMeter In Performance Testing Projects

ZEN LOAD BALANCER EE v3.04 DATASHEET The Load Balancing made easy

Stingray Traffic Manager Sizing Guide

Running a Workflow on a PowerCenter Grid

MEASURING WORKLOAD PERFORMANCE IS THE INFRASTRUCTURE A PROBLEM?

Apache and Tomcat Clustering Configuration Table of Contents

Distributed File Systems

Quantifying the Performance Degradation of IPv6 for TCP in Windows and Linux Networking

ZooKeeper. Table of contents

Cloud Operating Systems for Servers

Analysis of Delivery of Web Contents for Kernel-mode and User-mode Web Servers

Assessment Plan for CS and CIS Degree Programs Computer Science Dept. Texas A&M University - Commerce

Performance Evaluation of Shared Hosting Security Methods

Performance Analysis of Web based Applications on Single and Multi Core Servers

Overlapping Data Transfer With Application Execution on Clusters

ZEN LOAD BALANCER EE v3.02 DATASHEET The Load Balancing made easy

MailEnable Scalability White Paper Version 1.2

Performance and Tuning Guide. SAP Sybase IQ 16.0

Configuring Nex-Gen Web Load Balancer

CSC 2405: Computer Systems II

Chapter 6, The Operating System Machine Level

CHAPTER 1 - JAVA EE OVERVIEW FOR ADMINISTRATORS

Oracle WebLogic Server 11g Administration

ELIXIR LOAD BALANCER 2

Using In-Memory Computing to Simplify Big Data Analytics

No.1 IT Online training institute from Hyderabad URL: sriramtechnologies.com

Project Report on Implementation and Testing of an HTTP/1.0 Webserver

ZVA64EE PERFORMANCE BENCHMARK SOFINTEL IT ENGINEERING, S.L.

SAP HANA - Main Memory Technology: A Challenge for Development of Business Applications. Jürgen Primsch, SAP AG July 2011

Glassfish Architecture.

Oracle Net Services - Best Practices for Database Performance and Scalability

Achieving Real-Time Business Solutions Using Graph Database Technology and High Performance Networks

Accelerating Hadoop MapReduce Using an In-Memory Data Grid

ZEN NETWORKS 3300 PERFORMANCE BENCHMARK SOFINTEL IT ENGINEERING, S.L.

One Server Per City: C Using TCP for Very Large SIP Servers. Kumiko Ono Henning Schulzrinne {kumiko, hgs}@cs.columbia.edu

Optimizing Data Center Networks for Cloud Computing

Chapter 14 Virtual Machines

Deploying Load balancing for Novell Border Manager Proxy using Session Failover feature of NBM and L4 Switch

Adobe LiveCycle Data Services 3 Performance Brief

Resource Utilization of Middleware Components in Embedded Systems

Using Synology SSD Technology to Enhance System Performance Synology Inc.

MAGENTO HOSTING Progressive Server Performance Improvements

LOAD BALANCING TECHNIQUES FOR RELEASE 11i AND RELEASE 12 E-BUSINESS ENVIRONMENTS

How To Store Data On An Ocora Nosql Database On A Flash Memory Device On A Microsoft Flash Memory 2 (Iomemory)

HADOOP PERFORMANCE TUNING

S y s t e m A r c h i t e c t u r e

Performance Modeling for Web based J2EE and.net Applications

Exploring Oracle E-Business Suite Load Balancing Options. Venkat Perumal IT Convergence

Technical Paper. Moving SAS Applications from a Physical to a Virtual VMware Environment

Tyche: An efficient Ethernet-based protocol for converged networked storage

Scaling Objectivity Database Performance with Panasas Scale-Out NAS Storage

Tips and Tricks for Using Oracle TimesTen In-Memory Database in the Application Tier

Improving DNS performance using Stateless TCP in FreeBSD 9

Sentimental Analysis using Hadoop Phase 2: Week 2

Assessment for Master s Degree Program Fall Spring 2011 Computer Science Dept. Texas A&M University - Commerce

(n)code Solutions CA A DIVISION OF GUJARAT NARMADA VALLEY FERTILIZERS COMPANY LIMITED P ROCEDURE F OR D OWNLOADING

Apache Tomcat Tuning for Production

IERG 4080 Building Scalable Internet-based Services

COS 318: Operating Systems. Virtual Machine Monitors

XTM Web 2.0 Enterprise Architecture Hardware Implementation Guidelines. A.Zydroń 18 April Page 1 of 12

ELEC 377. Operating Systems. Week 1 Class 3

Applications Manager Best Practices document

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Java Bit Torrent Client

Mark Bennett. Search and the Virtual Machine

5nine Cloud Monitor for Hyper-V

Oracle Net Services: Best Practices for Database Performance and Scalability. Kant C Patel Director, Oracle Net Development

Virtualization Technologies and Blackboard: The Future of Blackboard Software on Multi-Core Technologies

Transcription:

A Comparative Study on Vega-HTTP & Popular Open-source Web-servers Happiest People. Happiest Customers

Contents Abstract... 3 Introduction... 3 Performance Comparison... 4 Architecture... 5 Diagram... 5 NIO Thread Pool... 5 Default Mode or In-Thread mode... 5 Worker Mode... 6 File Serving Mode...7 Architecture Choices... 7 C over C++ and Java... 7 Epoll over Select and Poll... 7 Epoll edge triggered mode over Epoll level Triggered mode... 7 Trie over Hash table...8 Centralized queue and eventfd over Pipes for message passing...8 Optimization Options...8 Thread Pool Size...8 Message passing File Handlers size...8 ` Epoll Initial Batch Size...9 Epoll Time Wait...9 Epoll Max Events to Stop Waiting...9 Future Enhancements...9 References...10 2

Abstract In this paper we present our lightweight, high-performance, low-latency web-server called VEGA-HTTP, its architecture and compare its performance with other existing popular open-source web-servers. Along with the existing platform we are also sharing things we have planned to develop in the future. Introduction A web-server is a computer program that is responsible for accepting HTTP (Hypertext Transfer Protocol) requests from the clients and serving them with HTTP responses along with optional contents which form web pages to the users, such as HTML documents and linked objects (images, etc.). Our Requirements: Handle high concurrent connections with extremely low latency and very less memory usage. Our Challenge: The existing servers failed to the above requirements at a very high load without utilizing the system resources to the fullest. Our Solution: The VEGA-HTTP server was built with a goal to overcome these challenges. This server has been built using the Linux kernel call epoll with the edge triggered mode at its heart. This enables it to handle the requests and maximizes performance by giving complete control of all the kernel level tuning parameters for better optimization of the server. 3

Performance Comparison The Performance Comparison in our test environment has been very encouraging. The results of the comparison showed how a modicum server can perform better than most of the open-source servers, available on the Internet. System Configuration: CPU : intel i3 3.3Ghz (2 cores) Processors : 4 RAM : 8GB OS : Xubuntu 14.04 x86_64 Test Suit : WRK We have three different types of tests with concurrencies 100 and 1000 for a period of 10 minutes. File Serving A Default mode or NIO mode Test A Worker Mode Test Benchmark Results: 139940 4

Architecture Diagram NIO Thread Pool Read Request Check Routes Worker thread pool Client Request Epoll Fetch Vega Core File Mode Read from file cache and respond Default Mode Pass request to controller Worker Mode Dispatch Request to worker thread pool Use the controller for processing the request and send the response to the NIO thread Response Handler sends the response back to the client Socket Layer Vega Core Using Linux kernel s epoll, Vega Core loads incoming client requests in a batch manner and dispatches request (based on configuration) to network I/O threads (NIO threads) for processing Linux system call epoll has support to wait on a particular set of open socket/file connections and once the request is ready epoll dispatches it to the NIO threads for processing and returns the response. The Kernel internally handles synchronization issues and only dispatches the complete requests that it has received. NIO Thread Pool The network input/output thread pool (NIO thread pool) has three tasks in the Vega server: Reading the request: Network thread fetches incoming request from open socket connection and parses the HTTP-headers and its HTTP-body content from the request Processing the request: The parsed headers request path is matched against the preloaded routes cache. There are three routes caches one for each mode (Default /Worker /File). Each path is configured with mode, path controller func tion or filename to serve in the route configuration file. Based on the configured mode they are loaded into either of the following cache s Default (or NIO) Mode, Worker Mode, and File Serving mode. 5

Some Key Decisions while Designing: For Processing, the routes cache is based on The Trie Data Structure where the key is the route path and value are the index points to the respective function pointers in the function pointer cache. Function pointer cache is normal in memory array which gets populated on server startup with all controller functions for faster execution. For file serving instead of the function pointer, it contains the file contents already loaded in the memory for quick serving. The File contents cache is populated on server startup with all file contents uploaded in memory. Other than the file cache all the other routes and functions cache are loaded per NIO thread so that they do not have to share any resources even with any other thread not even in read-only mode. Default Mode or In-Thread mode In the request life cycle after the route has been matched and if the route has been configured for default (NIO) mode, then the controller function is loaded in the same NIO thread which received and parsed the http request to process the request and the response context from the controller is sent back to the client as a http response. Worker Mode 6

In the request life cycle after the route has been matched and if the route has been configured for worker mode: The Network thread dispatches the request to the worker thread pool for processing the request. When the request is dispatched the NIO thread also passes the request object to the controller. The worker thread then executes controller function and stores response body in the context passed to it. After execution of the function, the worker thread has to send context data back to the network thread to respond back to the incoming request. For this purpose, an intermediate lock-free queue is used. The worker thread pushes the context data to the intermediate queue. The lock-free queue is common for all network threads and worker threads. To prevent thread locks and to reduce the latency lock free queues are used. After pushing context data to the queue, worker thread sends a notification to network thread via epoll with eventfd. Eventfd is a file mechanism which usually used for faster inter-thread messaging and it is supported by epoll. All network threads always wait for open socket/file connections from epoll. If the epoll triggers a network thread with eventfd file then that particular network thread reads data from the queue and responds back with the respective data to the incoming request. File Serving Mode All file contents are loaded in file-serving cache on server startup itself. When network thread recognizes the requested with file serving mode it directly loads the content from the cache and sends proper response headers to the client. Architecture Choices C over C++ and Java Linux system calls can be used flexibly in C over C++. Cross-language over system calls causes unnecessary buffer copying which will affect the overall performance of the server. This application requires more buffer to buffer transfers. JVM specific languages don t support some high performing system calls for file monitoring. Garbage collection affect application performance which completely forces JVM languages for out of system application programming. The JVM also doesn t have support for Epoll edge trigger mode. Epoll over Select and Poll In Linux environment, each socket connection is a file but doesn t support random access. There is a requirement in servers to notify when there is data available in open files with its file descriptors. To achieve this three familiar system calls are poll [3], select [2], and epoll [4]. Poll [3] performs faster when there is less number of files to monitor. Select [2] performs faster even when there is more number of connections but there is a requirement to fix the maximum number of files to monitor. Select [2] and Poll [3] doesn t support edge triggered mechanism. These two limitations are overcome in epoll command. Epoll is fast, flexible and supports various mode of operations. Epoll edge triggered mode over Epoll level Triggered mode Epoll supports two modes of operations Edge trigger and Level trigger: In Edge trigger mode when there is data available on any of the socket/file connection it will trigger hook function once. And all network threads listen to that hook function. In level trigger mode hook function gets called until data gets flushed. So if several threads listen to epoll all threads epoll hook function will get triggered. This causes synchronization and performance problem. The synchronization problem can be at least handled by preventing the mixing up of other threads with the first thread which actually fetches data. However performance problem will occur in level trigger mode because if all thread wakes up from thread pool all those require CPU time and unnecessary context switching will take place in processor level to provide CPU time for all threads. If Level trigger mode is used, a request can be handled by one thread but all other network thread will also be awake. If edge trigger mode is used a request can be handled by one thread and at the same time only that thread alone will be awake. Several High performance C servers use libev, libevent as its event managing multiplexing library. We stick with plain system call usages to prevent unnecessary abstraction which showed its part in performance. 7 129

Trie over Hash table The internal caches in our server completely uses Tries and plain c arrays. We have tested with glib hash table and glib tries for our cache. The performance of the glib tries was much greater than the hash table and hence we decided to use trie map. To improve the performance we are using a tire map which would have an index stored as the response of a trie lookup. The given index is used to access the data Object which is stored in a fixed size array. The change from a traditional hashmap implementation to a triemap for routing the increased performance of route lookups by 10% which is a significant number for such a small change in data Structure. The trie map is an ordered tree data structure that is used to store a dynamic set or associative array where the keys are usually strings. Unlike a binary search tree, no node in the tree stores the key associated with that node; instead, its position in the tree defines the key with which it is associated. All the descendants of a node have a common prefix of the string associated with that node, and the root is associated with the empty string. Values are not necessarily associated with every node. Rather, values tend only to be associated with leaves, and with some inner nodes that correspond to keys of interest. Initially when the server is being started it loads the routes into three different trie Maps one for each mode W - for the Worker mode of execution N - for the Network Thread mode of execution and F - for the file handler mode of execution. All the files are loaded into memory for quicker delivery. The route path and the files in the given directory is stored in the trie map for delivery. The index of the trie lookup is is pointed to the location where the files are stored in memory. Centralized queue and eventfd over Pipes for message passing Pipes is heavy when compared to eventfd. Eventfd doesn t support the direct transmission of data which makes it fast over pipes. Pipes require heavy system calls to copy data to pipes. Instead of pipes, adding data to an in-memory location is faster, hence, we preferred queue. Also, pipes forces to use heavy system calls in worker threads which will force context switching and reduce application performance. We used lock-free queue which is faster when used in between multiple threads which prevent thread locks. Optimization Options Thread Pool Size There are two different pools which can be optimized depending on the tasks that the server has to do. Network Thread Pool which is also referred to as NIO Thread Pool is the number of threads that receives and responds to the client request. The Default mode of execution happens within these threads. The Optimized choice for the thread pool size for maximized performance is the number of processing units that are available in the system. This can be found by running the bash command nproc in a Linux environment. Worker Thread Pool size is the number of threads that are allocated for the worker thread to execute the controller function. This can be set to higher level depending on the tasks that the controller has to perform. It is advised to perform IO operations in the worker thread mode to avoid blocking calls from being executed within the NIO thread pool as this will affect the number of requests that the server can handle directly. It is also advised to perform expensive operations in the worker thread mode to increase the throughput of the server. Message passing File Handlers size The message passing file handlers are used to communicate between the worker thread and the NIO thread to pass the http_response_context. If the number of requests that are being dispatched to the worker thread pool is high it is recommended to use a higher number of file handlers. The optimized number of file handlers is half of the network thread pool size. Note that this cannot be higher than the number of NIO threads. 8 129

Epoll Initial Batch Size The Epoll Initial Batch size is the maximum number of connection descriptors you expect to manage at one time. The kernel used this information as a hint for the amount of space to initially allocate in internal data structures describing events. (If necessary, the kernel would allocate more space if the caller's usage exceeded the hint given in size.) This size should be greater than zero. Epoll Time Wait The epoll time wait parameter is one of the two flags where the epoll_wait [1] command will exit returning all the events (requests) that are ready to process. The epoll time wait specifies the amount of time that the epoll has to wait before flushing the ready events (requests) for processing. The two variables that should be considered for setting this value are size of the operations in the handlers and the load the server receives. If the load of the server is high and the operation time is less it is recommended to have a higher time wait. If the load is less than it is recommended to have a smaller time wait. Note it is recommended to modify this parameter while load testing your handlers for different concurrency levels for better optimization. Epoll Max Events to Stop Waiting The epoll max events to stop waiting is the second of the two flags where the epoll_wait [1] command exit returning the number of events (requests) that is specified in the max events to stop waiting option. The two variables that should be considered for setting this value are size of the operations in the handlers and the load the server receives. If the load of the server is high and the operation time is less it is recommended to have a higher number of max events. If the load is less than it is recommended to have a smaller number of max events. Note it is recommended to modify this parameter while load testing your handlers for different concurrency levels for better optimization. Future Enhancements Language Support PHP Ruby Python SSL Support Multi Domain Support Proxy_pass (Load Balancer) File Streaming (For serving media and large files) Connectivity with existing frameworks WSGI FastCGI 9 129

References epoll_wait (http://linux.die.net/man/2/epoll_wait) poll (http://linux.die.net/man/2/poll) select (http://linux.die.net/man/2/select) epoll (http://linux.die.net/man/4/epoll) 10 129

About the Author Data Analyst with Happiest Minds. His key interest is in building high performance computing environments which involves faster request processing, data streaming and analytics systems. Have worked for Digital Advertising industry where main challenges are running complex algorithms on huge data and that too on real time. Suresh Raja An expert in both Web based/backend distributed, n-tier and Client/Server Applications. Having sound domain knowledge in Digital Advertising Industry and large scale Big Data processing, Analytical and Machine Learning systems. Highly passionate in building large scale distributed systems which could handle huge volumes of data. Vishnu Prasad Happiest Minds Happiest Minds enables Digital Transformation for Enterprises and Technology providers by delivering seamless Customer Experience, Business Efficiency and Actionable Insights through an integrated set of Disruptive Technologies: Big Data Analytics, Internet of Things, Mobility, Cloud, Security, Unified Communications, etc. Happiest Minds offers domain centric solutions applying skills, IPs and functional expertise in IT Services, Product Engineering, Infrastructure Management and Security. These services have applicability across industry sectors such as Retail, Consumer Packaged Goods, Ecommerce, Banking, Insurance, Hi-tech, Engineering R&D, Manufacturing, Automotive and Travel/Transportation/ Hospitality. Headquartered in Bangalore, India, Happiest Minds has operations in the US, UK, Singapore, Australia and has secured $52.5 million Series-A funding. Its investors are JPMorgan Private Equity Group, Intel Capital and Ashok Soota. 2014 Happiest Minds. All Rights Reserved. E-mail: Business@happiestminds.com Visit us: www.happiestminds.com Follow us on This Document is an exclusive property of Happiest Minds Technologies Pvt. Ltd 11 129