Skip to content

Commit

Permalink
Merge pull request TechEmpower#801 from bclozel/boot-upgrade
Browse files Browse the repository at this point in the history
Upgrade Spring dependencies and fix setup
  • Loading branch information
msmith-techempower committed Mar 14, 2014
2 parents a9989fd + 1c054c5 commit 1a254b4
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 20 deletions.
8 changes: 4 additions & 4 deletions spring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ Check out [SampleApplication, the main Application file](src/main/java/com/teche
## Infrastructure Software Versions
The tests were run with:

* [Spring 4.0.0.RC1](http://projects.spring.io/spring-framework/)
* [Spring Boot 0.5.0M6](http://projects.spring.io/spring-boot/)
* [Spring Data JPA 1.4.2.RELEASE](http://projects.spring.io/spring-data-jpa/)
* [Spring 4.0.2.RELEASE](http://projects.spring.io/spring-framework/)
* [Spring Boot 1.0.0.RC4](http://projects.spring.io/spring-boot/)
* [Spring Data JPA 1.5.0.RELEASE](http://projects.spring.io/spring-data-jpa/)
* [Java OpenJDK 1.7.0_09](http://openjdk.java.net/)
* [Tomcat 8.0.0-RC5](https://tomcat.apache.org/)
* [Tomcat 8.0.3](https://tomcat.apache.org/)
11 changes: 8 additions & 3 deletions spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>0.5.0.M7</version>
<version>1.0.0.RC4</version>
</parent>

<groupId>com.techempower</groupId>
Expand All @@ -19,7 +19,7 @@

<properties>
<java.version>1.7</java.version>
<tomcat.version>8.0.0-RC10</tomcat.version>
<tomcat.version>8.0.3</tomcat.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -47,7 +47,7 @@
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring3</artifactId>
<artifactId>thymeleaf-spring4</artifactId>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
Expand All @@ -70,6 +70,11 @@
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</repository>
<repository>
<id>bintray</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>

<pluginRepositories>
Expand Down
2 changes: 1 addition & 1 deletion spring/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def start(args, logfile, errfile):
try:
subprocess.check_call("mvn clean package", shell=True, cwd="spring", stderr=errfile, stdout=logfile)
subprocess.Popen(("java -Xmx2048m -Xms2048m -XX:MaxPermSize=256m -Ddatabase.host=" + args.database_host + " -jar spring.war").rsplit(" "), cwd="spring/target", stderr=errfile, stdout=logfile)
subprocess.Popen(("java -Ddatabase.host=" + args.database_host + " -jar spring.war").rsplit(" "), cwd="spring/target", stderr=errfile, stdout=logfile)
return 0
except subprocess.CalledProcessError:
return 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.SpringBootServletInitializer;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.apache.coyote.AbstractProtocol;
import org.apache.coyote.ProtocolHandler;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
Expand All @@ -22,14 +22,14 @@ public class TomcatCustomizer implements EmbeddedServletContainerCustomizer {
@Value("${tomcat.connector.maxConnections}")
private int maxConnections;

@Value("${tomcat.connector.acceptCount}")
private int acceptCount;

@Value("${tomcat.connector.maxKeepAliveRequests}")
private int maxKeepAliveRequests;

@Value("${tomcat.connector.minSpareThreads}")
private int minSpareThreads;

@Override
public void customize(ConfigurableEmbeddedServletContainerFactory factory) {
public void customize(ConfigurableEmbeddedServletContainer factory) {

customizeTomcatConnector((TomcatEmbeddedServletContainerFactory) factory);
}
Expand All @@ -45,10 +45,10 @@ public void customize(Connector connector) {
if (handler instanceof AbstractProtocol) {
AbstractProtocol protocol = (AbstractProtocol) handler;
protocol.setMaxThreads(maxThreads);
protocol.setMinSpareThreads(minSpareThreads);
protocol.setConnectionTimeout(connectionTimeout);
protocol.setMaxConnections(maxConnections);
}
connector.setProperty("acceptCount", acceptCount+"");
connector.setProperty("maxKeepAliveRequests", maxKeepAliveRequests+"");
}
}
Expand Down
18 changes: 13 additions & 5 deletions spring/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,23 @@ spring:
hibernate:
naming-strategy: org.hibernate.cfg.EJB3NamingStrategy
ddl-auto: validate
open_in_view: true
open_in_view: false

tomcat:
connector:
maxThreads: 200
minSpareThreads: 100
# reduce context switching; Intel Xeons have 12 threads
maxThreads: 12
connectionTimeout: 20000
maxConnections: 200
maxKeepAliveRequests: 2000
# maximum: 16K connections test
maxConnections: 20000
# handle initial connection spike
acceptCount: 20000
# avoid running out of ports due to connections stuck in TIME_WAIT state
maxKeepAliveRequests: -1

server:
tomcat:
access_log_enabled: false

---
spring:
Expand Down

0 comments on commit 1a254b4

Please sign in to comment.