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.

“Purikura” culture in Japan and our web application architecture

415 views

Published on

DevoxxUS Quickie Session on 2017/03/22
Our web application contains more than one billion files of young Japanese women's face image. The photos taken with Photo Booth and are sent to our application through the internet. We use Java, Spring Framework and Oracle RAC as well as MogileFS, is open source distributed filesystem for storing images, . We had not expected that our application had so many images when we started developing. I will explain our architecture, mainly forcused on use cases of MogileFS and troubles we've met. And I also will introduce Japanese "kawaii" culture. "kawaii" includes "lovable", "cute", or "adorable" and the quality of cuteness in the context of Japanese culture. Many Japanese young women take photos with Photo Booth to become more "kawaii".

Published in: Technology
  • Be the first to comment

“Purikura” culture in Japan and our web application architecture

  1. 1. Koichi Sakata FURYU CORPORATION / KanJava JUG “Purikura” culture in Japan and our web application architecture #DevoxxUS @jyukutyo#purijp
  2. 2. Where is Japan?
  3. 3. Talk about • Japanese culture – “Purikura” • Products that I’m using – MogileFS – Spring Cloud Contract Stub Runner
  4. 4. Japan of today • Ninja • Samurai • Anime/Manga • Purikura
  5. 5. “Purikura”
  6. 6. Photo sticker machine
  7. 7. • printed sticker • digital images
  8. 8. 10 years 6000 machines in JP $60 million / year
  9. 9. Japanese culture
  10. 10. Overview of our system
  11. 11. MogileFS • Distributed filesystem • Open source product • has three components
  12. 12. RDBMS tracker storage node MogileFS
  13. 13. 15 storage nodes 10 billion files 480 TB 6 years
  14. 14. MogileFS advantages • No single point of failure – run on multiple machines • Automatic file replication – replicate between different storage nodes – 3 replicas
  15. 15. Problem • disk usage unbalancing – execute rebalancing command
  16. 16. Sample case
  17. 17. Originally... 80 80 Server1 Server2 Usage(%)
  18. 18. Add a server 80 80 0 Server1 Server2 Server3 Usage(%) same disk space as Server 1,2
  19. 19. Increasing 85 85 40 Server1 Server2 Server3 Usage(%)
  20. 20. Rebalancing 75 75 40 10 10 20 Server1 Server2 Server3
  21. 21. Another problems • Not support Perl 6. • Last commit is in Dec 2014.
  22. 22. Clouds? • in the process of reviewing – AWS S3 • need to transfer 10 billion files...
  23. 23. MogileFS • capable of managing tera byte data • not active now
  24. 24. Our application architecture
  25. 25. Monolithic... • build time is long • difficult to change code • run tests again
  26. 26. Microservice
  27. 27. • eureka – Service Discovery • ribbon – Client Side Load Balancing • Hystrix – Circuit Breaker
  28. 28. Spring • Spring Boot • Spring Cloud Netflix
  29. 29. Problem
  30. 30. End to end test • How to test the case? – the case that an exception happens in the microservice
  31. 31. throw an exception and return 500 HTTP status code
  32. 32. Spring Cloud Contract Stub Runner
  33. 33. Spring Cloud Contract Stub Runner • replaces microservices with stubs • Stubs are run on WireMock • https://github.com/spring-cloud/spring-cloud- contract/tree/master/spring-cloud-contract-stub-runner • http://wiremock.org/
  34. 34. Stubbing
  35. 35. How to make and run stubs • Add maven plugin. • Write stub behavior in Groovy • Deploy stub to a repository • Run a Stub Runner with stubs
  36. 36. Maven plugin
  37. 37. <plugin> <groupId>org.springframework.cloud</groupId> <artifactId> spring-cloud-contract-maven-plugin </artifactId> <version>${spring-cloud-contract.version}</version> <extensions>true</extensions> <configuration> <!-- By default it would search under src/test/resources/ --> <contractsDirectory>${project.basedir}</contractsDirectory> </configuration> </plugin>
  38. 38. Groovy DSL
  39. 39. org.springframework.cloud.contract.spec.Contract.make { request { method 'POST' url '/example' body([ "id": 12345 ]) } response { status 201 body([ “name”: “john” ]) headers { contentType('application/json;charset=UTF-8’) } } }
  40. 40. Maven Deploy
  41. 41. $ mvn deploy/install [INFO] Installing ... stubs.jar
  42. 42. Run stub runner
  43. 43. $ cd to/stubrunner $ java -jar -Dstubrunner.ids=[groupId]:[artifactId] -Dstubrunner.idsToServiceIds. [artifactId]=something stubrunner.jar Stub runner downloads stubs from repository
  44. 44. Stub port?
  45. 45. http://localhost: 9001/stubs stub app port
  46. 46. $ cd to/stubrunner $ java -jar -Dstubrunner.ids=[groupId]:[artifactId] -Dstubrunner.idsToServiceIds. [artifactId]=something stubrunner.jar used to register in eureka
  47. 47. Summary • MogileFS is capable of managing tera byte data. • Spring Cloud Contract Stub Runner is useful. • Purikura is Japanese culture.
  48. 48. Thank you again for coming. #DevoxxUS @jyukutyo#purijp Thank you for coming

×