Published on

java evolution with large scale application

  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Cache, pool, msg/async ,mailbox ----performance of Data, process, event-router -runtime arch/org Async_Message - event
  • Cache and session replication/continuation
  • ehcache for biz layer,but also for or-mapping/hibernator, for the jsp /ehcacheWeb
  • For applications in this space, arbitrary in-database joins are already impossible since all the data is not available in any single database. A typical pattern is to introduce a caching layer which will require hashtable semantics anyway.
  • http:// Stale –tti ttl Pattern of access cache-aside (or direct manipulation) cache-as-sor (a combination of read-through and write-through or write-behind patterns) read-through write-through write-behind (or write-back) [] Continuation and session replication 1.Group commuication Javaspace - obj storage+event bus Jxta Jgroups –multicast Apache tribes 2.Mobile code, farm depoly — Discovery Delivery Replication/ /rmi Terracotta
  • With ehcache flash animation http:// Inject cluster aware bytecode The Terracotta deployment architecture has two primary components, client nodes and the Terracotta Server Array. Client JVMs. Your application servers or standalone Java application JVMs are connected to a Terracotta cluster using a Terracotta client driver. The Terracotta client driver is a JAR library that runs on standard Java Virtual Machines and is loaded when your application starts up. On startup, a Terracotta client JVM initiates a network connection with a Terracotta server instance. Once the connection is made, the client is allowed to proceed with its normal startup operations. As classes are loaded into the client JVM, they are instrumented with Terracotta bytecode modifications according to the Terracotta configuration Terracotta's clustering behavior is injected into application code at runtime by the use of bytecode instrumentation. Before the bytecode of a class is loaded by the JVM, Terracotta manipulates the bytecode of that class according to the Terracotta configuration. This includes acquiring clustered locks and pushing changes to clustered objects among other things. instrument only that subset of classes
  • p2p
  • CAP theory Consistency (一致性):即数据一致性,简单的说,就是数据复制到了 N 台机器,如果有更新,要 N 机器的数据是一起更新的。 Availability (可用性):好的响应性能,此项意思主要就是速度。 Partition tolerance (分区容错性):这里是说好的分区方法,体现具体一点,简单地可理解为是节点的可扩展性。 。如果 R + W > N 能够保证我们“读我们所写”, Dynamo 推荐使用 322 的组合。
  • Map-reduce, bigtable, hadoop STM Data flow CSP Pi Graph model Neo4j, db4o Doc model--couchDB
  • Domain soa Grid: Gridgain jppf Mmo , render-farm map reduce Hadoop 运维 社区 Myspace
  • 龙门阵 架构观察 现在对云计算的炒作就如同上百人在电话会议中狂吼一样喧嚣。回顾 20 年来 IT 的演变,较 为特别(其实也不那么特别)的一点就是每次新技术的诞生都发 生了喧嚣的炒作。以 4 到 5 年为周期的技术更新意味着大量赚钱的良机。从最早的大型机到客户端‐服务器、 CASE 工 具、 .COM 、企业架构 ( 如 EJB 和 DCOM) 、 SOA ,以及发展到现在的云计算, IT 一如既往地关 注于如何想方设法赚钱。
  • Proceeding 守望 javaEE 传播架构的基本 Sun--Left the glassfish Jee 闭门造车 From pattern to agile Container/sca v.s. ESB ~~~~~~~~~~~~~~~~~~~~~~~~~``` Stream as data Rmi v.s. thrift/protoc_buf json Rest sevice/mashup—comet/websocket
  • v.S nio pool? Actor not well when Need to achieve global consensus from grid to actor 1.Functional style, closure, tail-rec 2. Gpars or scala Thousand of light thread thread pool, For multi-core v.S nio pool? 3. ,async Msg , msg ,mail box : share nothing Actor ,no lock v.s. erlang  Context/thread switching is not free ? 4. Gridgain: aop ,p2p class loading split the process, not data partition ?? Continuation and the actor Parallel Collections For bio: pi-calculus, spim
  • Event driven actors concurrent actors that share a single pooled thread Using fork/join under the hood Supports distributed actors Implementation matters Threads are not free  Message sending is not free  Context/thread switching is not free  Lock acquire/release is not free
  • Arch Monitoring and tuning Weaver/piper make another kind query—data service !!   Pipe v.s. map-reduce dataflow Esper , twitter , esb AMQP cloudMQ 号称搞 Cloud + Event Driven Architecture = Internet Scale SOA Stream as data ----- 软件 /app 是个建筑 Soa 是城市规划 For bio-cell
  • Language/lib level facility JOSH Json osgi scala http Josch new mesg format: json/thrift/pro_buf
  • Charles Dickens
  • Another choice gigaspace Esper, pipe?cloudMQ ~~~~~~~~~`` Acotrs are assemly lang. need OTP Remote clustering As erlang OTP library. ~~~~~~~~ Narrator "."
  • Domain, the load target, Use real world applications soa Mmo , render-farm Grid: Gridgain jppf map reduce Hadoop Pipe and map/reduce
  • C:disks
    epo eckreading Use scala to try daj algo
  • Cache,Pool,Event

    1. 1. Cache, Pool, Event
    2. 2. Agenda <ul><li>On the cache </li></ul><ul><ul><li>Ehcache Consistence /Terracotta </li></ul></ul><ul><ul><li>NOSQL? Cassandra ‘s Partition </li></ul></ul><ul><ul><li>CAP theory </li></ul></ul><ul><li>Proceedings </li></ul><ul><ul><li>Actor </li></ul></ul><ul><ul><li>Event driven arch </li></ul></ul><ul><li>Next to do? </li></ul>
    3. 3. Cache <ul><li>Algo and metrics </li></ul><ul><li>Distributed cache </li></ul><ul><ul><li>Ehcache’s consistence </li></ul></ul><ul><ul><li>Terracotta: big heap @ vm clustering </li></ul></ul>
    4. 5. Cache in soft ties <ul><li>Web layer- session </li></ul><ul><li>DB layer – for OR mapping </li></ul><ul><li>Biz logic – for the object, graph … </li></ul>
    5. 6. Cache algorithm/metrics <ul><li>Algorithm </li></ul><ul><ul><li>LRU </li></ul></ul><ul><ul><li>LFU </li></ul></ul><ul><ul><li>FIFO </li></ul></ul><ul><li>Hit and miss </li></ul><ul><li>Cost </li></ul><ul><ul><li>Memory space, GC issue </li></ul></ul><ul><ul><li>Load </li></ul></ul><ul><ul><li>replacement </li></ul></ul>
    6. 7. Consistence in Ehcache <ul><li>Evict </li></ul><ul><ul><li>Delete elem </li></ul></ul><ul><ul><li>Overflow To disk </li></ul></ul><ul><ul><li>Delete local ,keep remote </li></ul></ul><ul><ul><li>Pluggable/customizable </li></ul></ul><ul><li>Replication for consistence, asynchronous </li></ul><ul><ul><li>Notify strategy </li></ul></ul><ul><ul><ul><li>Copy </li></ul></ul></ul><ul><ul><ul><li>invalidate </li></ul></ul></ul><ul><ul><li>pluggable cache replication scheme /group communication </li></ul></ul><ul><ul><ul><li>Jgroup </li></ul></ul></ul><ul><ul><ul><li>Jms </li></ul></ul></ul><ul><li>Used in Google App Engine </li></ul>
    7. 9. Terracotta <ul><li>Cluster for the heap </li></ul><ul><ul><li>One jvm with bigger heap </li></ul></ul><ul><li>JVM level clustering </li></ul>
    8. 11. Cluster wide visible changes JVM JVM JVM Change ACK ACK Terracotta Update and broadcast
    9. 12. Cassandra: partition <ul><li>DHT, from Amazon dynamo </li></ul><ul><ul><li>每个节点仅需维护少量相邻节点的信息 </li></ul></ul><ul><ul><li>节点动态加入 / 退出 </li></ul></ul><ul><ul><li>分布式地址 -key </li></ul></ul>
    10. 13. <ul><li>Key space partition </li></ul>
    11. 15. NOSQL history <ul><li>Cache memDB </li></ul><ul><ul><li>memcacheD </li></ul></ul><ul><li>Mysql sharding </li></ul><ul><li>Big table , map-reduce </li></ul><ul><ul><li>hadoop </li></ul></ul><ul><li>Dynamo, DHT </li></ul><ul><li>CAP theory </li></ul>
    12. 16. They don’t buy oracle <ul><li>运维 的压力 </li></ul><ul><ul><li>Practice in web2.0 application </li></ul></ul><ul><ul><li>Ebay, yahoo </li></ul></ul><ul><ul><li>Goolge amazon </li></ul></ul><ul><ul><li>Linkedin facebook twitter </li></ul></ul><ul><ul><li>Taobao douban </li></ul></ul><ul><li>草根的力量 , 分布式改善 </li></ul>
    13. 17. jEE die away?
    14. 18. Trend <ul><li>javaEE’s fate </li></ul><ul><ul><li>Spring’s challege </li></ul></ul><ul><ul><li>3 tier is gone, container v.s. router </li></ul></ul><ul><ul><ul><li>JBI v.s. SCA </li></ul></ul></ul><ul><li>New frontier : Scalable, HA, Concurrency </li></ul><ul><ul><li>Nosql </li></ul></ul><ul><ul><li>Actor </li></ul></ul><ul><ul><li>Async_messege, Event Driven </li></ul></ul>
    15. 19. From object to actor <ul><li>多核的挑战 </li></ul><ul><li>Actor—massive amount </li></ul><ul><ul><li>Focus shift From GC/heap to scheduler/thread_pool </li></ul></ul><ul><ul><li>Async Msg mailbox: share nothing </li></ul></ul><ul><ul><li>Map reduce, </li></ul></ul><ul><ul><ul><li>functional programming style </li></ul></ul></ul>
    16. 23. Async message works <ul><li>Event driven </li></ul><ul><li>Another msg intensive sys in app layer </li></ul><ul><li>Twitter and ISB </li></ul><ul><li>Event driven arch @message bus </li></ul><ul><ul><li>Router with rule </li></ul></ul><ul><ul><li>New SOA </li></ul></ul><ul><li>Complex event processing </li></ul>
    17. 24. JVM is still there <ul><li>Learn from Erlang community </li></ul><ul><ul><li>Scala </li></ul></ul><ul><li>Other new </li></ul><ul><ul><li>NIO: grizzly netty </li></ul></ul><ul><ul><li>Fork-join </li></ul></ul><ul><ul><li>Google collection </li></ul></ul><ul><ul><li>G1 </li></ul></ul><ul><ul><li>From xml to json/ thrift/protoc_buf </li></ul></ul>
    18. 25. <ul><li>It was the best of times ,it was worst </li></ul><ul><li>It was age of wisdom, also of foolishness </li></ul><ul><li>It was epoch of belief, also of incredulity </li></ul><ul><li>It was season of light, also of Darknes </li></ul><ul><li>It was spring of hope, also the winter of despair </li></ul><ul><li>We had everything before us, we had nothing before </li></ul><ul><li>We were all going direct to heaven, we were all going direct the other way </li></ul>
    19. 26. Next performance level <ul><li>Where do we go? </li></ul>
    20. 27. AKKA <ul><li>Feature </li></ul><ul><ul><li>Scala </li></ul></ul><ul><ul><li>Router camel, amqp </li></ul></ul><ul><ul><li>Cassandra Nosql plugin </li></ul></ul><ul><ul><li>Trans - actors: combine actors and STM into transactional actors </li></ul></ul>
    21. 28. 运维角度 <ul><li>Web 2.0,saas </li></ul><ul><li>Cloud/grid ? </li></ul><ul><ul><li>Internet service bus </li></ul></ul><ul><li>MMO- massive multiplayer online game </li></ul><ul><ul><li>facebook </li></ul></ul>
    22. 29. Benchmark for Comparing <ul><li>Compare all kinds of solution </li></ul><ul><ul><li>Benchmark input </li></ul></ul><ul><li>New Tuning points </li></ul><ul><ul><li>New monitoring </li></ul></ul><ul><li>Cloud for loading </li></ul><ul><ul><li>Use cloud as load agent </li></ul></ul><ul><ul><li>Utilize the actor language </li></ul></ul><ul><ul><ul><li>Narrator is a library which can be used to create story driven clustered load-testing packages through a very readable and understandable api </li></ul></ul></ul>
    23. 30. Beautiful arch <ul><li>书 </li></ul><ul><ul><li>架构之美 </li></ul></ul><ul><li>城市规划 或 造房 </li></ul><ul><ul><li>细胞 / 生命之结构 </li></ul></ul>