Interview with Qiu Peng, author of Firefly, an all-in-one Java Web development framework

Source: Internet
Author: User

Firefly is a high-performance, one-stop Java Web framework that covers the main technology stacks of web development, it includes the template engine, IOC/MVC Framework, HTTP server, common tool, log, JSON parser, and other modules.

Project home: http://www.fireflysource.com/
GitHub address: https://github.com/hypercube1024/firefly

In order to give you a better understanding of Firefly, We have interviewed Qiu Peng, the author of Firefly.

You are welcome to recommend more open-source projects to us to support the development of open-source projects in China. If you and your team wish to demonstrate their entrepreneurial ideas and interesting things, or some friends are creating such value, please contact us, mail to blog@csdn.com.

Let's introduce myself first!

My name is Qiu Pengyi, from Wuhan. I have been working in Beijing since graduation. I have been working in Beijing for six years. I am currently working in a large Internet company.

I mainly use Java as a programming language. I also studied iOS or other programming technologies. I recently read hacker and painter and started to be interested in clojure.

What is Firefly? What functions are available?

Firefly is an all-in-one high-performance Java Web framework. Firefly is easy to use. In the main function, a Web service can be started with only one line of code, and it is super lightweight. The jar package has a total of 500 kb. It takes less than 1 second to start a web service. It is very suitable for Internet applications that focus on development efficiency and service performance.

Firefly provides the following functions:

  • IOC/MVC Framework
  • Template Language
  • HTTP Server
  • JSON Parsing
  • Asynchronous log

What was your initial intention to develop this project? Is this a "Wheel" of SSH?

Before developing Firefly, I have been using open-source Java frameworks, such as spring, stucts, hibernate, and ibatis. However, I always feel that it is difficult to build a development environment using these frameworks, the compatibility of some frameworks after upgrade is also a problem, and SSH is bloated and the running speed is slow.

The ideal Web framework should run in 80% cases without complicated configuration and be lightweight and fast. Therefore, it is decided to develop Firefly as an alternative to ssh.

Firefly is indeed a wheel, but a better wheel, haha ^_^

What is Firefly's design philosophy?

Firefly is based on the idea that conventions are better than configurations. The framework automatically executes conventions or labeled functions, and the parameters are variable.

Firefly is non-invasive, and the program does not need to implement any interfaces and will not pollute the Business Code. In addition, the framework itself does not rely on any third-party jar package, and no third-party packages dependent on the Framework conflict with the dependent packages of Business Code.

Firefly pays great attention to the practicality of functions, and does not add uncommon functions to Firefly at ordinary times. This can avoid being too bloated like other open-source frameworks.

I personally think it is very important to keep the code concise. the fewer the code, the easier it is to read, and the easier it is to fix bugs. Borrow C. a.r. hoare's famous saying: There are two ways to design software: one is as simple as possible, this design clearly has no defect; the other is as complex as possible, this design has no obvious defect.

What components and modules does Firefly contain? What are the features?

Firefly consists of four modules: IOC/MVC Framework, template language, HTTP server, and common tool class:

  • The IOC/MVC Framework supports restful URL, interception chain, multi-view rendering, and other features.
  • The template language compilation method performs well and supports operations such as conditional selection, loops, and user-defined functions.
  • The NiO-based Web server supports most of the features of the http1.1 protocol. It supports dynamic template pages, static files, local session support, and remote session support through its own interface.
  • The common toolkit contains a variety of common tool classes, such as JSON parsing, asynchronous logs, and lruconcurrenthashmap.

What are the characteristics of Firefly compared to other frameworks (such as SSH and nutz?

Firefly is a web development framework. All functions are focused on web development without data access and ORM functions. The primary consideration is that relational databases are not necessarily the best choice for data storage in the face of massive Internet users. Many nosql databases can directly support object storage. If you use relational databases, you prefer tools like Apache dbutil instead of ORM.

The SSH and nutz frameworks provide more functions than Firefly, But Firefly is lighter and easier to use than SSH when providing most of the features of daily web development, performance is also much better. It also provides an HTTP server, which can be started directly using the main function without deployment.

What is Firefly's performance?

Because we work in Internet companies, our business has hundreds of millions of PVS every day. In the face of a large number of users, we usually develop programs that are sensitive to performance.

When developing Firefly, you will also pay more attention to performance. Firefly can easily run the network card Traffic, and its overall performance is three times faster than the combination of spring and tomcat. On my Macbook (dual-core 2.3 GB), we use Apache AB to test 10 million requests and 100 concurrent requests at 3 W req/s. The same hardware configuration of spring + Tomcat can only reach 1.2 W req/s. The template language is 1.5 ~ Faster than freemarker ~ 2x faster JSON serialization than gson's 4 ~ 8 times.

What is the learning cost of Firefly?

If you have experience using spring, you can get started directly. Firefly retains many spring usage habits and is simpler than spring.

What should I pay attention to when using Firefly?

Firefly does not support JSP when using its own HTTP server. Only the firefly template language can be used in standard Java EE servers.

What Open Source protocol is used? How do Users communicate, feedback, and contribute?

Firefly uses the commercial-friendly Apache 2.0 protocol to initiate a pull request directly on GitHub.

  • GitHub: https://github.com/hypercube1024/firefly
  • Google Code: http://code.google.com/p/firefly/
  • QQ: 95350530
  • Home: http://www.fireflysource.com/

Future development plan?

I recently studied the spdy Implementation of jetty, and translated some of the spdy V3 documents. I may post the documents on the Internet when I am free :-).

The spdy Protocol adds an ID for each request, so that multiple requests can be initiated concurrently on a TCP connection, making full use of the IO multiplexing capability and improving the network connection utilization, this is what the http1.1 and Apache JK protocols cannot do.

In the next version of Firefly, spdy protocol and HTTPS are supported, and a spdy proxy is developed as the front-end Server Load balancer and cache. In addition, the function of Firefly JSON parser needs to be enhanced to support serialization of circular references and stream interfaces.

What are the insights in the open-source process? What is the domestic open-source environment?

The development of open-source software is mainly maintained by interest. After developing Firefly, you will have a deeper understanding of the Web development technology stack and various network protocols, there are still some differences between implementing a framework by yourself and understanding other people's code.

The open-source environment in China is far worse than that in other countries. After all, there is a lot of pressure in domestic life, and there are not many companies that focus on technology. According to Maslow's demand theory, as long as everyone's life is better, I believe more people will be involved in the development of open source software.

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: info-contact@alibabacloud.com 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.