Performance of spring 3 and yii demonstration programs

Source: Internet
Author: User

Spring and yii are representative frameworks of Java and PHP.

Performing stress tests on the demo program can deepen the understanding of the differences between the PHP and Java languages and facilitate the architecture evaluation.

The following tests the performance of the sample program petclinic of spring3 and the demonstration program blog of yii1.1.13 respectively,

Both programs are simple requests-> processing a small amount of data read-> page return, which belongs to the same lightweight application and can be compared.

[Test Environment]

ThinkPad X1 carbon

Windows 8 (x64)

Processor Core (TM)-I5, 1.7 GHz

Memory (RAM) 4.0 GB

SSD 128 GB

[Test Tool]

Siege for windows,

Siege 2.74

[Test object and result]

1. spring3-petclinic framework sample

The steps for building a petclinic test environment are as follows:

  • Install jdk1.7.0 _ 21
  • Install eclipse Kepler release
  • Install plug-in m2e
  • Install GitHub for Windows
  • Install Maven to c: \ Program Files \ apache-maven-3.1.0
  • Configure the maven home/Java home environment variable and add % m2_home %/bin, % java_home %/bin to the system variable path.

After the environment is installed, you can check out the code and perform the following steps:

    git clone https://github.com/SpringSource/spring-petclinic.git    mvn tomcat7:run

If everything is normal, you can access http: // localhost: 9966/petclinic/through a browser, and the cute pet dog will appear.

If "the symbol cannot be found" appears, add import manually;

If the expected test result is incorrect, it may be caused by mismatch between Chinese and English results. comment out the result matching statement first.

Petclinic uses the hsql memory database by default. to change it to MySQL, You need to modify it in two places:

  • Database Access Profile src/main/resources/spring/data-access.properties
  • Project management File spring-petclinic/POM. XML, modify the database dependency

Run the test:

C: \ Users \ iefreer> siege-B-t30s http: // localhost: 9966/petclinic/vets.html

Concurrency is roughly 160 TRANS/sec.

Try to read non-data pages, which is roughly 500 TRANS/sec.

2. yii1.1.13 blog demo

Install Apache service with Zend ce 5.5.0

Change httpd. conf, set document_root to the blog directory, restart the apache service, and access:

Http: // localhost/index. php/post/Index

Welcome! And other blog articles

Run the test:

C: \ Users \ iefreer> siege-B-t30s http: // localhost/index. php/post/Index

Concurrency 36.42 TRANS/sec, try to turn off APC cache (add cache component configuration in Main. php, add cache in post query statement to enable query cache ),

The result is almost 40 TRANS/sec, with little impact.

Try again to test the non-data reading page:

C: \ Users \ iefreer> siege-B-t30s http: // localhost/index. php/about

Concurrency is roughly 280 TRANS/sec

[Test conclusion]

From the execution result of the default configuration, We can roughly think that the spring3 program is 2 ~ faster than the yii program ~ 4 times.

Of course, we will not discuss the maintenance/release of spring (Java)/yii (PHP) code here. It is much easier to modify, release, and debug the code of yii without compilation.

By iefreer

A story about spring and yipk, dedicated to the 36-year-old birthday night, recording the bit of life

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.