2019獨角獸企業重金招聘Python工程師標準>>>
使用Jfinal一段時間了,記得當初14年吧,為了建立一個簡單的門戶網站,想找個輕量型的急速開發框架,然后搜到Jfinal,然后用了一段時間后,確實不錯, 現在吧,隨著時間的推移,作者對JFinal的版本迭代也是一直在努力,一直朝著優秀的方向走去;
這里做下對Jfinal的使用記錄;
為什么要用Jfinal:?
- 輕: 輕到什么程度呢, 體積小,框架僅339K,且無第三方依賴
- 快
- 開發快:?粘貼復制就是可以做到簡單的模塊增刪改查;
- 啟動快: 內置jetty啟動,直接運行main方法就可以啟動整個web項目
- 編譯快: 熱編譯的支持,更是讓jfianl使用者留下更多的時間陪家人
- 便捷
- 支持Validator后端校驗
- AOP支持,攔截器配置靈活便捷
- Plugin體系結構,擴展性強,比如兼容spring定時器什么的也可以做到(當然,不推薦使用xml的方式)
- 無xml配置,框架接口簡單明了
- 學習成本低,上手快,,這才是重點;節約更多的時間可以去陪戀人,家人
說了Jfinal的好處,那么Jfinal到底適合哪些應用場景呢,適合多大的運行項目呢;
適合中小型項目,這主要是針對一些業務處理不是很復雜的項目;
- ???????看表?? ? 200來張表 ,可以定位中型項目吧
- ????????? ? ? 看代碼量 ? ?(未知)
- ???????????????? ? ? 物理大小 ? (未知)
? ???????看案例吧,具體說也難說, 看到的才最明了,?以下是Jfinal做的一些項目:
????http://www.ysshow.com?
????http://www.666ys.cn?
等等
關于性能及訪問壓力測試
- 100 個線程并發,20000次請求
ab -n 20000 -c 100 http://202.114.79.246:8280/portal/login?username=zhangsan\&password=123 This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright 2006 The Apache Software Foundation, http://www.apache.org/Benchmarking 202.114.79.246 (be patient) Completed 2000 requests Completed 4000 requests Completed 6000 requests Completed 8000 requests Completed 10000 requests Completed 12000 requests Completed 14000 requests Completed 16000 requests Completed 18000 requests Finished 20000 requestsServer Software: Apache-Coyote/1.1 Server Hostname: 202.114.79.246 Server Port: 8280Document Path: /portal/login?username=zhangsan&password=123 Document Length: 2412 bytesConcurrency Level: 100 Time taken for tests: 2.754403 seconds Complete requests: 20000 Failed requests: 0 Write errors: 0 Total transferred: 53053260 bytes HTML transferred: 48252060 bytes Requests per second: 7261.10 [#/sec] (mean) Time per request: 13.772 [ms] (mean) Time per request: 0.138 [ms] (mean, across all concurrent requests) Transfer rate: 18809.52 [Kbytes/sec] receivedConnection Times (ms)min mean[+/-sd] median max Connect: 0 1 2.0 2 9 Processing: 2 11 3.4 11 51 Waiting: 0 5 3.6 5 38 Total: 2 13 3.8 13 53Percentage of the requests served within a certain time (ms)50% 1366% 1475% 1580% 1590% 1795% 1898% 1999% 29100% 53 (longest request)
- 100 個線程并發,30000 次請求
ab -n 30000 -c 100 http://202.114.79.246:8280/portal/login?username=zhangsan\&password=123 This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright 2006 The Apache Software Foundation, http://www.apache.org/Benchmarking 202.114.79.246 (be patient) Completed 3000 requests Completed 6000 requests Completed 9000 requests Completed 12000 requests Completed 15000 requests Completed 18000 requests Completed 21000 requests Completed 24000 requests Completed 27000 requests Finished 30000 requestsServer Software: Apache-Coyote/1.1 Server Hostname: 202.114.79.246 Server Port: 8280Document Path: /portal/login?username=zhangsan&password=123 Document Length: 2412 bytesConcurrency Level: 100 Time taken for tests: 4.336593 seconds Complete requests: 30000 Failed requests: 0 Write errors: 0 Total transferred: 79581216 bytes HTML transferred: 72379296 bytes Requests per second: 6917.87 [#/sec] (mean) Time per request: 14.455 [ms] (mean) Time per request: 0.145 [ms] (mean, across all concurrent requests) Transfer rate: 17920.98 [Kbytes/sec] receivedConnection Times (ms)min mean[+/-sd] median max Connect: 0 2 1.8 2 10 Processing: 1 11 3.3 12 56 Waiting: 0 5 3.4 5 51 Total: 2 13 3.6 14 57Percentage of the requests served within a certain time (ms)50% 1466% 1575% 1580% 1690% 1795% 1898% 1999% 28100% 57 (longest request)
- ?200 個線程并發,10 萬次請求
?ab -n 100000 -c 200 http://202.114.79.246:8280/portal/login?username=wangkai\&password=123 This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright 2006 The Apache Software Foundation, http://www.apache.org/Benchmarking 202.114.79.246 (be patient) Completed 10000 requests Completed 20000 requests Completed 30000 requests Completed 40000 requests Completed 50000 requests Completed 60000 requests Completed 70000 requests Completed 80000 requests Completed 90000 requests Finished 100000 requestsServer Software: Apache-Coyote/1.1 Server Hostname: 202.114.79.246 Server Port: 8280Document Path: /portal/login?username=wangkai&password=123 Document Length: 2411 bytesConcurrency Level: 200 Time taken for tests: 15.194965 seconds Complete requests: 100000 Failed requests: 0 Write errors: 0 Total transferred: 265219295 bytes HTML transferred: 241208495 bytes Requests per second: 6581.13 [#/sec] (mean) Time per request: 30.390 [ms] (mean) Time per request: 0.152 [ms] (mean, across all concurrent requests) Transfer rate: 17045.32 [Kbytes/sec] receivedConnection Times (ms)min mean[+/-sd] median max Connect: 0 10 147.1 3 3019 Processing: 1 18 7.0 18 228 Waiting: 0 8 6.7 8 220 Total: 4 29 147.4 21 3047Percentage of the requests served within a certain time (ms)50% 2166% 2475% 2680% 2790% 3095% 3398% 3799% 43100% 3047 (longest request)
相對于 struts2 性能提升 8 倍左右,相對 spring 性能提升兩倍多,只要服務器性能好并且沒有數據庫或其它瓶頸,并發 1000 以上不是問題;
不過,Jfinal只不過是你整個架構的一部分,并發訪問量承受能力完全取決于你的整體架構如何;
官方并沒有給出具體數據,以上數據類型是截至開源社區中的內容;?
沒有對比就沒有傷害(Jfinal PK springMVC)
- 開發效率至少比spring快三倍以上(主要由于熱編譯,啟動快,結構簡單,無xml)
- Jfinal?Db + Record模式,靈活便利 ,維護量少
- spring 本身就很厚重,在加上ser/get封裝類,維護麻煩
- 同樣是添加Validator后端校驗,springMVC配置則要麻煩的多?
- 更多的就需要你自己去體驗了
以上對比是在開發中小型(業務不復雜)項目的時實際經驗總結; ?
?
?