×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

Persist session and R/W Object cache

If you do want the client lost the session, then you need to persist the session in your database or by messaging(WAS 5.1 Network deployment version support it).
By the way, all the objects put into session need to implement the Serializable interface. Some times that will be your big code change.
If you do not care the session lost, it is fine.
If you have some object cache to read and write, it maybe not consistency seems different thread in different server may update differently.
This is from appication perspective. Just for your reference.
Report

Replies, comments and Discussions:

  • 工作学习 / 专业技术讨论 / WAS5.1下开发的J2EE application, 从non-clustering环境迁移到clustering,会有什么潜在问题?
    • EARfile和你的WASapp.server是否cluster没有关系。
    • 一般主要问题发生在web工程的session management上。
      • 可否说得更详细点?谢谢
        • 就是说来自同一台客户端的请求有可能被传到集群中不同的服务器上。大部分集群服务器都有解决这个问题的功能,否则就得依靠WAS的后台session。
          • 换个访问策略不就行啦。每次都访问一台机子。
        • 写程序的时候记得从session拿出东西后再加上一句session.setAttribute(xxx)就行啦。
          • 这个是对weblogic的。
          • You didn't get the point
        • Persist session and R/W Object cache
          If you do want the client lost the session, then you need to persist the session in your database or by messaging(WAS 5.1 Network deployment version support it).
          By the way, all the objects put into session need to implement the Serializable interface. Some times that will be your big code change.
          If you do not care the session lost, it is fine.
          If you have some object cache to read and write, it maybe not consistency seems different thread in different server may update differently.
          This is from appication perspective. Just for your reference.
    • Don't need to change even one line of code in your application. There should be a load balancing management module in the middleware to let you to configure, depending on what specific middleware you are using.
      • you must be kidding. one example: 如果程序中用到cache, 就需要增加cache同步程序。
        • I really don't know what you mean by "增加cache同步程序". I bet you are not making your code coupling with other system, which should be in different tier.
          IBM WebSphere introduces Dynamic Cache and Data Replication Service. In your application, implement DistributedMap public interface:

          Import com.ibm.websphere.cache.DistributedMap;

          DRS replicates the cached object across the whole cluster and keeps the consistency of the cached data.
          • Last year I did a project, which need migrate an application from non-cluster env to cluster env. The persisten layer of the application is based on Oracle Toplink.
            How could you sync toplink cache without changing even one line of code? 老系统千奇百怪,你这话大了点。
            • Sorry, dude, you are right, and depends on J2EE middleware, the code is different. But when we start coding, we always put cluster support into consideration, even when we are not sure wether the cluster will be used.
              Actually the difference is to apply some interfaces in the code, that is all. Middleware will do the rest: loading, syncronization, failover, etc. What test tool do you use for load balance test?
    • 如果你没有使用session,如果你没有在web端缓存数据,你不会遇到任何问题。如果你缓存了数据,参考session的集群中的方案:
      1)最简单的方法是将来自一个客户端的请求绑定到一台服务器上;
      2)稍微复杂一些的是在第一个请求被导向的服务器上保存session,其他服务器可以访问这个session的数据,这样来自一个客户端的请求可以被导向不同的服务器;但是一个服务器的崩溃仍然会导致其上的session丢失;
      3)在所有的服务器上复制session,方式又分为内存复制、文件共享、磁盘阵列、数据库等。
    • Depends on what type of cluster topology do you use: vertical or horizontal. Make code change on (1) file synchronization, (2) session obejct serializing and (3) dynamic cache by using WebSphere Dynamic Cache and Data Replication Service.
      • it's not depends on the cluster topology. it's depends on the technology that used on the project. I guess you do not have much experience on that.
        • A coder's task is to call API, or create or Test API, that is it, you don't need to know network topology.
          That is the job for application architecturer, and network admin. Just like you know TCP/IP, you don't need to know what type of network is. Actually as a coder, you don't need to know TCP/IP at all.