现在的开源框架都是大而全,动辄xxMB的jar包,感觉用不了那么多的功能,而且性能有些不尽如人意。所以还是自己造个轮子吧。
firefly的特性
- 高性能,性能大幅超越spring3、struts2等,详情请看性能测试报告
- 精简、轻量、无侵入,firefly.jar只有44k
- core包含IOC、MVC、Interceptor等常用功能
- 使用简单,基于约定优于配置的思想,默认使用Annotation配置方式
firefly的使用风格类似Spring3,具体可以看
http://code.google.com/p/firefly/wiki/guide
代码已经发布到 google code ,有兴趣的同学可以一起来开发
http://code.google.com/p/firefly/
测试环境
- windows7 jdk1.6.0_22
- JDK参数:-Xms128m -Xmx512m -XX:+DisableExplicitGC
- 服务器:jetty 6.1.25
- CPU: T6600 内存:3G
- 测试工具:JMeter
用例1测试报告¶
往JSP打印“你好 firefly!”
500线程,循环2次
取跑10次之后的成绩
框架 | 版本 | 吞吐量 | 错误率 |
fireflyMVC | 1.0-SNAPSHOT | 38910.506/分钟 | 0% |
Servlet | 2.5 | 38022.814/分钟 | 0% |
Spring3MVC | 3.0.5.RELEASE | 13106.16/分钟 | 0% |
Struts2 | 2.2.1.1 | 1256.571/分钟 | 0% |
用例1
往JSP打印“你好 firefly!”
JSP代码
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>firefly</title> </head> <body> ${hello} </body> </html>
firefly测试代码
@RequestMapping(value = "/hello") public String index(HttpServletRequest request) { request.setAttribute("hello", "你好 firefly!"); return "/index.jsp"; }
Servlet测试代码
@Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setAttribute("hello", "你好 firefly!"); request.getRequestDispatcher("/WEB-INF/page/index.jsp").forward( request, response); }
Spring3MVC测试代码
@RequestMapping(value="/spring", method=RequestMethod.GET) public String index(HttpServletRequest request) { request.setAttribute("hello", "你好 firefly!"); return "/index"; }
Struts2测试代码
public String execute() throws Exception { setMessage("你好 firefly!"); return SUCCESS; }