Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Boot in Production

1,298 views

Published on

Morning at Lohika presentation about Spring Boot Microservices and related production issues, monitoring and tools.

Published in: Software
  • Be the first to comment

Boot in Production

  1. 1. SPRING BOOT Before and after the release 2@twincengray @morningatlohika Oleksiy Rezchykov February 2015
  2. 2. About me Software Test Engineer Last 7 years working with Java and Spring XP/Agile/Lean practitioner Lazy Pragmatic programmer 3@twincengray @morningatlohika
  3. 3. Plan for today: Introduction to Spring Boot Black magic of auto configuration Testing in Spring Boot Logging and Monitoring What’s next? 4@twincengray @morningatlohika
  4. 4. Context Playtika facts Founded in 2010 Multiplatform social games developer Headquarters in Tel-Aviv Offices in US, Canada, Ukraine, Belarus, Romania and Argentina Industry facts Social Casino segment is growing faster than other Social Games segments Mobile platforms is the main focus for developers More about Playtika and Social Casino genre: http://www.slideshare.net/eladkushnir/final-ccsf-elad-kushnir 5@twincengray @morningatlohika
  5. 5. Intro Boot 6@twincengray @morningatlohika
  6. 6. Demo application architecture ToDo Share app – to share ToDo’s User Service Account Service ToDo Service Tests projects 7@twincengray @morningatlohika
  7. 7. Auto configuration # Initializers org.springframework.context.ApplicationContextInitializer= org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer # Auto Configure org.springframework.boot.autoconfigure.EnableAutoConfiguration= org.springframework.boot.autoconfigure.aop.AopAutoConfiguration, org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration, org.springframework.boot.autoconfigure.MessageSourceAutoConfiguration, org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration, org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration, org.springframework.boot.autoconfigure.cloud.CloudAutoConfiguration, org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration, org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration, org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration, org.springframework.boot.autoconfigure.data.mongo.MongoRepositoriesAutoConfiguration, org.springframework.boot.autoconfigure.data.solr.SolrRepositoriesAutoConfiguration, org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration, org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration, org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration, org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration, org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration, org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration, org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.XADataSourceAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration, org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration, org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration, org.springframework.boot.autoconfigure.jms.JndiConnectionFactoryAutoConfiguration, org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration, org.springframework.boot.autoconfigure.jms.hornetq.HornetQAutoConfiguration, org.springframework.boot.autoconfigure.jta.JtaAutoConfiguration, org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchAutoConfiguration, org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchDataAutoConfiguration, org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration, org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration, org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration, org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration, org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration, org.springframework.boot.autoconfigure.mobile.DeviceResolverAutoConfiguration, org.springframework.boot.autoconfigure.mobile.DeviceDelegatingViewResolverAutoConfiguration, org.springframework.boot.autoconfigure.mobile.SitePreferenceAutoConfiguration, org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration, org.springframework.boot.autoconfigure.mongo.MongoDataAutoConfiguration, org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, org.springframework.boot.autoconfigure.reactor.ReactorAutoConfiguration, org.springframework.boot.autoconfigure.redis.RedisAutoConfiguration, org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration, org.springframework.boot.autoconfigure.security.FallbackWebSecurityAutoConfiguration, org.springframework.boot.autoconfigure.social.SocialWebAutoConfiguration, org.springframework.boot.autoconfigure.social.FacebookAutoConfiguration, org.springframework.boot.autoconfigure.social.LinkedInAutoConfiguration, org.springframework.boot.autoconfigure.social.TwitterAutoConfiguration, org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration, org.springframework.boot.autoconfigure.velocity.VelocityAutoConfiguration, org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration, org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration, org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration, org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration, org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration, org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration, org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration, org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration, org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration, org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration 8@twincengray @morningatlohika
  8. 8. Auto configuration @Configuration @Conditional @ConditionalOnClass/@ConditionalOnMissingClass @ConditionalOnBean/@ConditionalOnMissongBean @ConditionalOnProperty @ConditionalOnResource @ConditionalOnWebApplication/@ConditionalOnNotWebA pplication @ConditionalOnExpression 9@twincengray @morningatlohika
  9. 9. Auto configuration WTF’s “The Spring Boot auto-configuration tries its best to ‘do the right thing’, but sometimes things fail and it can be hard to tell why.” Spring Documentation http://docs.spring.io/spring-boot/docs/1.2.1.RELEASE/reference/htmlsingle/#howto-troubleshoot-auto- configuration 10@twincengray @morningatlohika
  10. 10. Customizing auto configuration Let’s try… 11@twincengray @morningatlohika
  11. 11. Testing with Boot Small tests Tests with ApplicationContext MVC tests (standalone/WAC) 12@twincengray @morningatlohika
  12. 12. Boot Integration tests @WebIntegrationTest 13@twincengray @morningatlohika
  13. 13. Logging with Boot Supports: Log4j, Logback, Log4j2 What we need is: External log configuration (env bound) Re-load of log configuration Log storing for further processing Logstash?Graylog and stuff 14@twincengray @morningatlohika
  14. 14. Actuator – Boot monitoring /autoconfig /beans /configprops /dump /env /health /info /metrics /mappings /shutdown /trace 15@twincengray @morningatlohika
  15. 15. Actuator Metrics System DataSource Tomcat session Custom 16@twincengray @morningatlohika
  16. 16. Monitoring tools Jconsole YourKit AppDynamics NewRelic 17@twincengray @morningatlohika
  17. 17. What’s next Spring Cloud (esp. Netflix OSS integration, Amazon/Cloud Foundry tooling) Spring Session Dropwizard (!?!?!) 18@twincengray @morningatlohika
  18. 18. Summary If you want to use a tool – learn it Spring Boot is not a silver bullet If you want to sleep at night after releases - monitor everything and be able to re-configure your application 19@twincengray @morningatlohika
  19. 19. Materials https://github.com/mcgray/Medium-test-poc http://www.slideshare.net/mcgray http://spring.io/blog/ http://projects.spring.io/spring-boot/ About us https://twitter.com/BorodaMalezhyka #вгеймдевенасовсем 20@twincengray @morningatlohika
  20. 20. Thank you! orezchykov@playtika.com oleksiy.rezchykov@gmail.com @twincengray 21@twincengray @morningatlohika We are hiring!

×