Linux lightweight Web Server Page 1/2

Source: Internet
Author: User
Tags litespeed small web server

Specialized HTTP applications supplemented by Apache and other market-leading products

Level: Intermediate Cameron Laird (, Vice President, Phaseit, Inc. July 23, 2007

In recent years, many interesting Web Server implementations have emerged, including lighthttpd, litespeed, and mongrel. These Web servers are declared to combine performance, manageability, portability, security, and other related values. The following engineering research will investigate lightweight Web servers to help you select the Web servers most likely to meet the technical needs of the next project.

"Lightweight" Web server, suchlighthttpd,litespeedAndmongrel, Can bring many benefits to the project. This article investigates this possibility and shows the applicability of these Web servers.

What does a Web server need?

The first important aspect is a clear understanding of the fields under investigation (see references for more details ). The basic action of an end user on the Internet is to "enter a Web page ". In general, this involves collaboration between two applications:

  • A Web browser, such as Firefox or Internet Explorer, is used to request a specific page and display the content received from another application in a human-readable manner.
  • A Web server, usually on a remote machine, is responsible for responding to page requests and returning HTML-encoded or similar data streams.

All Web users interact directly with browsers, so their selection and analysis are somewhat enthusiastic. The server is only visible to the site's technical staff. According to Netcraft's recent survey, although there are many different Web servers, two of them account for 90% of the shares, the two Web servers are Apache and Internet Information Server (IIS ). They are all highly refined products, and claim not only to have a wide range of internal technical features, but also to have a lot of supporting books, add-ups, consultants, providers and so on. So, are there any other places worth making?

The answer is yes. Important indicators for evaluating a Web server include:

  • Performance: How fast can a request be responded?
  • Scalability: Can the server continue to run reliably when many users access it at the same time?
  • Security: Whether the server executes only the operations it should perform. How does it support user authentication and encrypted transmission? Does it make nearby applications or hosts more vulnerable?
  • Reliability: What is the failure mode and failure rate of the server?
  • Standard compliance: Does the server comply with the related RFC?
  • Flexibility: Can I tune the server to support heavy request loads, dynamic pages to be calculated, or expensive authentication?
  • Platform requirements: Which platforms can this server be used? Does it have specific hardware requirements?
  • Easy Management: Is the server easy to set and maintain? Is it compatible with Organization standards such as logging, auditing, and cost computing?

Apache and IIS cannot be the best in so many standards at the same time. In theory, it is clear that targeted products can surpass market leaders in at least one or two of the above aspects.

One interesting and noteworthy thing about lightweight Web servers is that the competition between them is far more than theoretical: careful research shows that they haveManyThings can be provided, and even in many common cases, they stick to their own style with respect to Apache and IIS. Although we can reasonably think that market leaders have been carefully optimized to effectively avoid being defeated in performance (for example, however, because many small competitors only provide simple static Web Page ServicesFaster. When using these Web servers to run the test, you may feel like driving a go-kart car on the track, which is beyond Porsche and Viper without knowing it. This is not all: Sometimes, lightweight Web servers can be used as the effectiveSupplementInstead of competing with them. Even if you know that you will use Apache, sometimes you can use it to the maximum extent by partnering with a lightweight partner. The best solution sometimes requires collaboration between two or more Web servers.

Back to Top

Lightweight Web Services

The focus of this survey is actually a subjective quality, like "art" or "style ". It usually means simplicity, ease of installation, streamlining, low requirements, and robustness-smaller and simpler than Apache and IIS, of course, in the process of trying to satisfy a large number of markets, they have become very complex. For this purpose, although Java Web Server, AOLserver, and Zeus have charming portability and performance advantages, their complexity and size have to be rejected.

Lightweight Web servers can be used when market leaders and other "heavyweight" servers are not competent. For example, the entire server can be packaged in a file. This means that developers can easily carry all the tools required by the production environment. Even if Apache is running on the production server, you can still try new ideas in the hotel room by using a lightweight Web server that can be installed in just a few seconds. Moreover, because lightweight Web servers have low requirements, they can run smoothly on hosts that cannot afford IIS.

Single file Packaging

Single file Packaging
Apache requires careful installation of many files distributed in multiple directories. The difference is that the following Web server is packaged in an executable file. One of my employers, Phaseit, specializes in deployment and packaging. We can make Apache installation look simpler than usual. However, even if we do our best, there is still a big difference between Apache or IIS and lightweight Web servers in terms of "space usage": the former occupies a large amount of space.

Small and lightweight Web servers can also run well on low-power hosts. In our company (Phaseit-see the sidebar), we run dedicated hardware on Industrial Computers remotely, in poor conditions, or in poorly configured environments. In these cases, it is a great advantage to provide Web pages through an application with low processing capacity or disk space requirements. This means that our machines can avoid the overhead of Apache development and processing capabilities and build a Web-based management console.

To some extent, almost all lightweight Web servers are open source code. If we need a specific Web server behavior, some Web servers described below are very small, easy to understand, and easy to enhance, with only two exceptions. These Web servers provide excellent raw materials for projects embedded in Web services, whether these Web services are in special hardware, or in a specific application designed to run on a general computer. They are also widely used for websites with traditional appearances:

  • YouTube relies on lighttpd to quickly deliver archived content, such as videos;
  • CdServe runs "German Woodworking Machinery and Tools" CD;
  • LiteSpeed promotes its role on twitter,,,,, SlashGear,, and other famous websites;
  • OpenSUSE, RubyOnRails, MarkaBoo, and other famous websites depend on Mongrel;
  •,,, The Drudge Report,, and other sites use thttpd;
  • And so on.

The following example illustrates how lightweight servers are used by developers: in our company, we use dedicated hardware to provide office telephone solutions. It is based on customized software that runs in the form of traditional Linux applications. Only one additional file and oneinit.dConfiguration, it is easy to add a powerful "Web Console", which provides a management interface for hardware and software. End users can monitor and configure their computers from any browser without having to arrange dedicated hardware connections or solve other complexities that often occur when using vertical hardware.

SOA is considered difficult to use. In our experience, SOA at least has some disadvantages that impede the use of Web services. We use lightweight Web services to set up fast SOA for demonstration.

Lightweight servers can even be used in production data centers, including the high-profile sites listed above. Websites with high performance will separate operations to maximize the use of caching, proxy, and other technologies. For example, an Apache-based site may adopt an architecture that provides slowly changing images from a dedicated file system through a small Web server. End users see the output of Apache and one or more auxiliary Web Servers through collaboration. They assume their respective roles. This arrangement can be provided at a very low computing cost.VeryQuick results.

Back to Top

Means and purpose

Although lightweight Web servers have many similarities, they are different. Most lightweight Web servers are written in C, but practice has proved that some other implementation languages can be successfully used to implement servers, these languages include Erlang, Java, Lisp, Lua, Perl, Python, and Tcl. If you have your favorite language, you may find a suitable Web server.

For many specific reasons, you may look at an "Uncommon" language:

  • Teaching: use lightweight Web servers to develop an important but not big goal. This is a good way to gain experience in a language.
  • Although the size of the lightweight Web Server compiled in C is 10-50 KB, the more advanced languages include 100 KB to several MB runtime, the entire Web ServerSource FileIt may take up to several thousand bytes. This Web Server occupies a small amount of space, so it is easier to share with technical partners than Apache.
  • More advanced languages can make the experiment more attractive-for example, adding a new HTTP/1.1 feature may only require a few lines of source code. These lightweight servers are very convenient lab materials.
  • Add the HTTP server to an existing application written in advanced languages with only a few lines of source code.

Athana can be used as an example of these topics. It is a Web server written in Python. It supports HTTP multipart (upload), session, cookie, and so on. Since version 0.2.1, Athana has been written in a separate, well-organized source file.

As mentioned above, different lightweight Web servers have different advantages. They are more or less independent of programming languages. All lightweight Web servers are smaller and easier to configure than Apache. Compared with Apache, some lightweight Web servers are faster, while someMuch faster. Some emphasize security, ease, scalability, or memory usage under heavy loads. In any situation, you can thoroughly understand these servers in a way that is not applicable to Apache.

Which specific products make these possibilities a reality? Even if you only pay attention to the "lightweight" server, it is also a collection of products that are difficult to manage. However, they can be divided by sub-classes: ultra-light, security-oriented, and support for specific language-based.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.