Java one 2010

766 views
730 views

Published on

第四回SCDN

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
766
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Java one 2010

  1. 1. Javaone 2010 report Tadaya Tsuyukubo @ttddyy http://bit.ly/ttddyy_javaone2010
  2. 2. Oracle OpenWorld + JavaOne Year 2010 Sep 19-23 San Francisco
  3. 4. Java 7, 8 <ul><ul><li>Productivity </li></ul></ul><ul><ul><li>Performance </li></ul></ul><ul><ul><li>Modularity </li></ul></ul><ul><li>  </li></ul><ul><ul><ul><li>Project Coin </li></ul></ul></ul><ul><ul><ul><ul><li>Productivity with More Concise Code </li></ul></ul></ul></ul><ul><ul><ul><li>Project Lambda </li></ul></ul></ul><ul><ul><ul><ul><li>Closures for Java </li></ul></ul></ul></ul><ul><ul><ul><li>Project Jigsaw </li></ul></ul></ul><ul><ul><ul><ul><li>The Modular Java Platform </li></ul></ul></ul></ul><ul><li>  </li></ul><ul><ul><ul><ul><ul><li>NIO2(jsr203),  Concurrency and Collections updates(jsr166y), JDBC4.1, etc. </li></ul></ul></ul></ul></ul>
  4. 5. Project Coin <ul><ul><li>Diamond </li></ul></ul><ul><ul><ul><ul><ul><li>Map<String, List<Integer>> map = new HashMap<>() </li></ul></ul></ul></ul></ul><ul><ul><li>Try-with-resources </li></ul></ul><ul><ul><ul><ul><ul><li>try( InputStream is = new FileInputStream(in); </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>      OutputStream os = new FileOutputStream(out) ) { </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>     ... </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>} catch (Exception e) { </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>     ... </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>} </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>  </li></ul></ul></ul></ul></ul><ul><li>  </li></ul><ul><ul><li>Strings in Switch </li></ul></ul><ul><ul><li>Improved integral literals </li></ul></ul><ul><ul><li>Vargs warnings </li></ul></ul><ul><ul><li>Multi-catch & precise rethrow </li></ul></ul>
  5. 6. Project Lambda <ul><ul><li>SAM (Single Abstract Method) </li></ul></ul><ul><ul><ul><ul><ul><li>    Collections.sort( data, #( int a, int b ){ a.length() - b.length() } ); </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>    double max =  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>        students.filter(  #{ s -> s.gradYear == 2010 })  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>                     .map(  #{ s -> s.score })  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>                     .max(); </li></ul></ul></ul></ul></ul><ul><ul><li>Method Reference  </li></ul></ul><ul><li>  </li></ul><ul><ul><ul><ul><ul><li>     Collections.sortBy(students,  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>                                #Student.getName); </li></ul></ul></ul></ul></ul>
  6. 7. Project Jigsaw <ul><ul><li>eliminate the class path </li></ul></ul><ul><ul><li>light weight memory foot print </li></ul></ul><ul><ul><li>module-info.java </li></ul></ul><ul><ul><ul><li>meta data (module dependency info) </li></ul></ul></ul><ul><ul><ul><ul><ul><li>@Version(&quot;1.0&quot;)  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>@ImportModules( {     @ImportModule(name=&quot;java.se&quot;),  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>    @ImportModule(name=&quot;com.foo.OrderProcessingService&quot;),  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>    @ImportModule(name=&quot;com.bar.PrintService&quot;)  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>} )  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>@MainClass(&quot;hello.HelloWorld&quot;)  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>module hello; </li></ul></ul></ul></ul></ul>
  7. 8. etc. <ul><ul><li>Value Class </li></ul></ul><ul><ul><ul><ul><ul><li>  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>value class Foo {  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>    property Foo parent;  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>    property String name;  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>} </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>  </li></ul></ul></ul></ul></ul><ul><ul><li>JVM </li></ul></ul><ul><ul><ul><li>upto 32G Heap Compaction </li></ul></ul></ul><ul><ul><ul><li>NUMA (Non-Uniform Memory Access) </li></ul></ul></ul><ul><ul><ul><li>G1GC (Garbage First GC) </li></ul></ul></ul><ul><ul><li>Integrate JRockit to HotSpot  </li></ul></ul><ul><ul><ul><li>Nondisruptive, Scalable, High Performance VM </li></ul></ul></ul>
  8. 9. Java Release Plan <ul><li>Plan B </li></ul><ul><ul><li>Java7  (mid 2011) </li></ul></ul><ul><ul><ul><li>most of &quot;Project Coin&quot; </li></ul></ul></ul><ul><ul><ul><li>New I/O APIs </li></ul></ul></ul><ul><ul><ul><li>Fork/Join Framework </li></ul></ul></ul><ul><ul><ul><li>InvokeDynamic </li></ul></ul></ul><ul><ul><ul><li>etc. </li></ul></ul></ul><ul><ul><li>Java8  (late 2012) </li></ul></ul><ul><ul><ul><li>Project Lambda </li></ul></ul></ul><ul><ul><ul><li>Project Jigsaw </li></ul></ul></ul><ul><ul><ul><li>Rest of Project Coin </li></ul></ul></ul><ul><ul><ul><li>etc. </li></ul></ul></ul>
  9. 10. Web related tech sessions <ul><ul><li>EJB3 features (Transaction, Business Tier) </li></ul></ul><ul><ul><ul><li>Bean Validation (JSR303) </li></ul></ul></ul><ul><ul><ul><ul><li>Hibernate Validator </li></ul></ul></ul></ul><ul><ul><ul><li>CDI(Contexts and Dependency Injection)  (JSR299) </li></ul></ul></ul><ul><ul><ul><ul><li>@Inject, @Model, @Singleton, @Stateless, etc. </li></ul></ul></ul></ul><ul><ul><ul><li>JPA 2.0  (JSR317)  </li></ul></ul></ul><ul><li>  </li></ul><ul><ul><li>  For Java6 </li></ul></ul><ul><ul><ul><li>Common Annotation for the Java Platform (JSR250) </li></ul></ul></ul><ul><ul><ul><ul><li>@Resource, @PostConstruct, @PreDestroy </li></ul></ul></ul></ul>
  10. 11. Annotation Jam @Secure @Transactional @RequestScoped @Named   class SomeClass {     ...... } @BusinessLogic   class SomeClass { } use customized stereotype
  11. 12. Web session summary <ul><ul><li>new features are mostly available in spring </li></ul></ul><ul><ul><ul><li>using spring is a correct choice </li></ul></ul></ul><ul><ul><ul><li>giving more confusion to developers </li></ul></ul></ul><ul><ul><li>EJB containers are required </li></ul></ul><ul><ul><ul><li>mostly commercial </li></ul></ul></ul><ul><ul><ul><li>still heavy weight </li></ul></ul></ul><ul><li>  </li></ul><ul><li>Advantage of using EJB </li></ul><ul><ul><li>session clustering </li></ul></ul><ul><ul><li>remoting </li></ul></ul><ul><ul><li>commercial support? </li></ul></ul><ul><ul><li>vendor specific tools </li></ul></ul>spring is much better!!      - lightweight      - integration to other tech
  12. 13. Case Study  (mint.com) <ul><ul><li>Free personal financial management web </li></ul></ul><ul><ul><li>2billion financial transaction </li></ul></ul><ul><ul><li>10m+ transaction per day </li></ul></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>Architecture </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><ul><li>spring + hibernate </li></ul></ul><ul><ul><li>memcached </li></ul></ul><ul><ul><li>intensive use of AOP </li></ul></ul>
  13. 14. DB Scaling <ul><li>NOSQL </li></ul><ul><ul><li>lose integrity  ==> not best fit </li></ul></ul><ul><li>  </li></ul><ul><li>User ID based sharding </li></ul><ul><ul><li>Hierarchical data model </li></ul></ul><ul><ul><li>Logical database separation </li></ul></ul><ul><ul><ul><li>user data & non user data </li></ul></ul></ul><ul><ul><li>put user_id to all hierarchical entities (user data) </li></ul></ul><ul><ul><ul><li>every user data is exclusive and have locality </li></ul></ul></ul>
  14. 15. Implementation <ul><li>Minimize infrastructure sharding info to implementation context </li></ul><ul><ul><li>annotation  </li></ul></ul><ul><ul><li>AOP </li></ul></ul>@MintUserdata class UserService {     .... } @MintCommondata class MasterDataService {     .... } switch SessionFactory, Datasource by AOP based on the annotation
  15. 16. Monitoring <ul><ul><li>collect data from real prod requests </li></ul></ul><ul><ul><ul><li>viewed page, traffic, behavior </li></ul></ul></ul><ul><ul><ul><li>cache statistics </li></ul></ul></ul><ul><ul><ul><li>hibernate statistics </li></ul></ul></ul><ul><ul><ul><li>thread pool & queue size </li></ul></ul></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><ul><li>monitoring overhead must be low  </li></ul></ul><ul><ul><ul><li>aggregate results in memory </li></ul></ul></ul><ul><ul><ul><li>persist periodically </li></ul></ul></ul>
  16. 17. Monitoring Impl <ul><li>monitor all spring beans </li></ul><ul><ul><li>AOP autoproxy all beans, no code change </li></ul></ul><ul><ul><li>All methods (request-response lifecycle) can be drilldown </li></ul></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><ul><li>build custom tool (80/20 rule) </li></ul></ul><ul><ul><li>intensive use of AOP to monitor application error logs </li></ul></ul><ul><ul><li>log messages are parametrized, centeralized </li></ul></ul><ul><ul><li>web tool to easily search/parse errors </li></ul></ul><ul><ul><ul><li>like splunk </li></ul></ul></ul>~/account.htm?id=1 100ms AccountController#info() 10ms AccountService#getInfo() 20ms AccountDao#getInfoById() 70ms
  17. 18. Security & How to reduce Bug <ul><li>Use hibernate to enforce isolation </li></ul><ul><ul><li>use AOP or hibernate callback </li></ul></ul><ul><ul><ul><li>if data tries to access data that doesn't belong to the user, throws exception </li></ul></ul></ul><ul><li>  </li></ul><ul><li>Detect crosstalk (multi thread test) </li></ul><ul><ul><li>run test class with multiple user (sequential, multithread) </li></ul></ul>
  18. 19. Case Study (eBay) <ul><ul><li>10bil requests per day </li></ul></ul><ul><ul><li>10K java servers </li></ul></ul><ul><ul><li>partition everything </li></ul></ul><ul><ul><li>asynchronous everywhere </li></ul></ul><ul><ul><li>automate everything </li></ul></ul><ul><ul><li>everything fails </li></ul></ul><ul><ul><li>embrace inconsistency </li></ul></ul><ul><ul><li>expect (r)evolution </li></ul></ul><ul><ul><li>dependencies matters </li></ul></ul><ul><ul><li>respect authority (data) </li></ul></ul><ul><ul><li>never enough data </li></ul></ul><ul><ul><li>custom infrastructure </li></ul></ul>
  19. 20. Case Study (Sinapto) <ul><li>Online Poker in Italy </li></ul><ul><li>3000 concurrent players </li></ul><ul><li>Architecture </li></ul><ul><ul><li>Vertical, Horizontal partitioning (table, tournament) </li></ul></ul><ul><ul><li>asynchronous  (event driven) </li></ul></ul><ul><ul><li>pass around status object </li></ul></ul>
  20. 21. Case Study (Caché) <ul><li>Specialized to write huge data </li></ul><ul><li>  </li></ul><ul><li>    example: </li></ul><ul><ul><ul><ul><li>3-D map of Galaxy        </li></ul></ul></ul></ul><ul><ul><ul><ul><li>monitor 1billion stars, more & more newly found ones </li></ul></ul></ul></ul><ul><ul><ul><ul><li>(Peta byte level data) </li></ul></ul></ul></ul><ul><ul><ul><ul><li>  </li></ul></ul></ul></ul><ul><ul><ul><ul><li>stock market trading information </li></ul></ul></ul></ul><ul><ul><ul><ul><li>government, healthcare, financial industry </li></ul></ul></ul></ul><ul><ul><li>solution: </li></ul></ul><ul><ul><ul><li>wrote DB : 130+K sustained inserts per sec </li></ul></ul></ul>
  21. 22. JDBC:     runs over tcp/ip (even locally)        use JNI (Java Native Interface)    Store multi dimensional data     XEP: serialize & store     MDS: Monitoring & Deiscovery Service
  22. 23. NOSQL <ul><ul><li>This does not replace RDBMS </li></ul></ul><ul><ul><li>Suit for representing data in a simple datastructure </li></ul></ul><ul><ul><ul><li>High Scalability </li></ul></ul></ul><ul><ul><ul><li>Flexible modification </li></ul></ul></ul><ul><ul><ul><li>Specialized process </li></ul></ul></ul><ul><li>  </li></ul><ul><li>Characteristic </li></ul><ul><ul><li>no join </li></ul></ul><ul><ul><li>mostly search data by single rowkey </li></ul></ul><ul><ul><li>eventual consistency </li></ul></ul>
  23. 24. <ul><li>Data Model </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>Eventual Consistency </li></ul><ul><ul><li>no transaction, no consistency </li></ul></ul><ul><ul><ul><li>application needs to handle consistency </li></ul></ul></ul><ul><li>Example: </li></ul><ul><ul><li>For column based DB, there is no association table, and no cascade delete. </li></ul></ul><ul><ul><li>When parent data is removed, child data needs to deleted by application </li></ul></ul>RDBMS NoSQL relational column, KV, etc.
  24. 25. Testing <ul><li>Unit Test </li></ul><ul><ul><li>selenium IDE </li></ul></ul><ul><ul><li>junit </li></ul></ul><ul><ul><li>mock </li></ul></ul><ul><li>Integration Test </li></ul><ul><ul><li>starting container at beginning of test in code </li></ul></ul>
  25. 26. Functional Programming      &quot;OO is better to project our world structure          FP excels at actual coding of the algorithm&quot;     Use OO to build classes     Use FP to implement methods Java 7, 8 will have FP(closure) feature. (lambda project)
  26. 27. Conclusion <ul><li>spring is the best!! </li></ul><ul><li>  </li></ul><ul><li>Java future loadmap, Case Studies </li></ul><ul><li>  </li></ul><ul><li>javaone 2010 </li></ul><ul><li>  </li></ul><ul><li>Technical sessions </li></ul><ul><ul><li>Spring One </li></ul></ul><ul><ul><li>Server Side </li></ul></ul><ul><ul><li>No Fluff, Just Stuff </li></ul></ul><ul><li>  </li></ul><ul><li>met jp java community </li></ul>

×