12
返回列表 发新帖
楼主: Sky-Tiger

Logging jdbc operations with Log4jdbc.

[复制链接]
论坛徽章:
350
2006年度最佳版主
日期:2007-01-24 12:56:49NBA大富翁
日期:2008-04-21 22:57:29地主之星
日期:2008-11-17 19:37:352008年度最佳版主
日期:2009-03-26 09:33:53股神
日期:2009-04-01 10:05:56NBA季后赛大富翁
日期:2009-06-16 11:48:01NBA季后赛大富翁
日期:2009-06-16 11:48:01ITPUB年度最佳版主
日期:2011-04-08 18:37:09ITPUB年度最佳版主
日期:2011-12-28 15:24:18ITPUB年度最佳技术原创精华奖
日期:2012-03-13 17:12:05
11#
 楼主| 发表于 2012-6-27 00:40 | 只看该作者

使用道具 举报

回复
论坛徽章:
350
2006年度最佳版主
日期:2007-01-24 12:56:49NBA大富翁
日期:2008-04-21 22:57:29地主之星
日期:2008-11-17 19:37:352008年度最佳版主
日期:2009-03-26 09:33:53股神
日期:2009-04-01 10:05:56NBA季后赛大富翁
日期:2009-06-16 11:48:01NBA季后赛大富翁
日期:2009-06-16 11:48:01ITPUB年度最佳版主
日期:2011-04-08 18:37:09ITPUB年度最佳版主
日期:2011-12-28 15:24:18ITPUB年度最佳技术原创精华奖
日期:2012-03-13 17:12:05
12#
 楼主| 发表于 2012-7-8 15:19 | 只看该作者
Are you looking to scale out your Java application? Well, then I've got some bad news for you: Your Java application probably won't scale. Java applications just don't scale well. Get used to it because it's a simple fact.

Now I know what you're thinking. You're thinking that this simple assertion is wrong; after all, all of those Servlet and JSP based applications that you wrote ten years ago had no problem moving onto a handful of JVMs that were spread out over a horizontally and vertically scaled cluster. And indeed, those types of applications scaled up and scaled out just fine. It’s the bigger Java applications that get scaled to a large number of processors that run into problems.

使用道具 举报

回复
论坛徽章:
350
2006年度最佳版主
日期:2007-01-24 12:56:49NBA大富翁
日期:2008-04-21 22:57:29地主之星
日期:2008-11-17 19:37:352008年度最佳版主
日期:2009-03-26 09:33:53股神
日期:2009-04-01 10:05:56NBA季后赛大富翁
日期:2009-06-16 11:48:01NBA季后赛大富翁
日期:2009-06-16 11:48:01ITPUB年度最佳版主
日期:2011-04-08 18:37:09ITPUB年度最佳版主
日期:2011-12-28 15:24:18ITPUB年度最佳技术原创精华奖
日期:2012-03-13 17:12:05
13#
 楼主| 发表于 2012-7-8 15:19 | 只看该作者
Are you looking to scale out your Java application? Well, then I've got some bad news for you: Your Java application probably won't scale. Java applications just don't scale well. Get used to it because it's a simple fact.

Now I know what you're thinking. You're thinking that this simple assertion is wrong; after all, all of those Servlet and JSP based applications that you wrote ten years ago had no problem moving onto a handful of JVMs that were spread out over a horizontally and vertically scaled cluster. And indeed, those types of applications scaled up and scaled out just fine. It’s the bigger Java applications that get scaled to a large number of processors that run into problems.

使用道具 举报

回复
论坛徽章:
350
2006年度最佳版主
日期:2007-01-24 12:56:49NBA大富翁
日期:2008-04-21 22:57:29地主之星
日期:2008-11-17 19:37:352008年度最佳版主
日期:2009-03-26 09:33:53股神
日期:2009-04-01 10:05:56NBA季后赛大富翁
日期:2009-06-16 11:48:01NBA季后赛大富翁
日期:2009-06-16 11:48:01ITPUB年度最佳版主
日期:2011-04-08 18:37:09ITPUB年度最佳版主
日期:2011-12-28 15:24:18ITPUB年度最佳技术原创精华奖
日期:2012-03-13 17:12:05
14#
 楼主| 发表于 2012-7-8 15:19 | 只看该作者
The Java scalability problem

You see, the Java scalability problem doesn't rear its ugly head until you start moving into big, multi-processor systems. Java can scale just fine to two or three, or maybe even five or six processors, but once you move beyond the single digits, your scalability won't be linear, and if scalability isn’t linear, it really isn’t scalable at all.

If we have two processors running, we want our programs to be twice as fast as when it runs with only one processor. An eight-processor system should be twice as fast as a four processor system, and so on - that's linear scaling. There really isn't any system that is perfectly linear in its scalability, but a linear scale is always the objective. Sadly, Java programs don't even come close to scaling linearly, and the reasons why all boil down to locking.

使用道具 举报

回复
论坛徽章:
350
2006年度最佳版主
日期:2007-01-24 12:56:49NBA大富翁
日期:2008-04-21 22:57:29地主之星
日期:2008-11-17 19:37:352008年度最佳版主
日期:2009-03-26 09:33:53股神
日期:2009-04-01 10:05:56NBA季后赛大富翁
日期:2009-06-16 11:48:01NBA季后赛大富翁
日期:2009-06-16 11:48:01ITPUB年度最佳版主
日期:2011-04-08 18:37:09ITPUB年度最佳版主
日期:2011-12-28 15:24:18ITPUB年度最佳技术原创精华奖
日期:2012-03-13 17:12:05
15#
 楼主| 发表于 2012-7-8 15:19 | 只看该作者
The Java scalability problem

You see, the Java scalability problem doesn't rear its ugly head until you start moving into big, multi-processor systems. Java can scale just fine to two or three, or maybe even five or six processors, but once you move beyond the single digits, your scalability won't be linear, and if scalability isn’t linear, it really isn’t scalable at all.

If we have two processors running, we want our programs to be twice as fast as when it runs with only one processor. An eight-processor system should be twice as fast as a four processor system, and so on - that's linear scaling. There really isn't any system that is perfectly linear in its scalability, but a linear scale is always the objective. Sadly, Java programs don't even come close to scaling linearly, and the reasons why all boil down to locking.

使用道具 举报

回复
论坛徽章:
350
2006年度最佳版主
日期:2007-01-24 12:56:49NBA大富翁
日期:2008-04-21 22:57:29地主之星
日期:2008-11-17 19:37:352008年度最佳版主
日期:2009-03-26 09:33:53股神
日期:2009-04-01 10:05:56NBA季后赛大富翁
日期:2009-06-16 11:48:01NBA季后赛大富翁
日期:2009-06-16 11:48:01ITPUB年度最佳版主
日期:2011-04-08 18:37:09ITPUB年度最佳版主
日期:2011-12-28 15:24:18ITPUB年度最佳技术原创精华奖
日期:2012-03-13 17:12:05
16#
 楼主| 发表于 2012-7-8 15:20 | 只看该作者
Java and linear scalability

Objects in Java are the basic building blocks of the language. Objects contain data, and sometimes objects point to data contained within other objects. As Java applications become more and more complex, and as more and more lists and arrays hold objects and data, and as more and more lists and arrays hold pieces of data that indirectly point at other pieces of data, keeping track of what is where and who is pointing at what becomes incredibly confusing.

To maintain any semblance of order, concurrent Java programs use threads that lock pieces of data when a part of the program (let's say Method A) needs access. If another part of the program (Method B) needs access to that same piece of data, Method B is locked out and needs to wait for Method A to finish and unlock the data.

The more processors your throw at a Java program, the more often these data collisions happen, and you eventually hit a point where the whole JVM is simply bogged down in the process of managing and manipulating locks. A point eventually gets reached where adding another processor is about as productive as adding another mythical man to the development team.

"Java provides threads and locks as the primary parallel programming model during operation. It is very simple, it is very straight forward, but it has an obvious cost model. It turns out that in practice in large programs, it becomes very difficult to get it right unless you add locks everywhere. The result of this is that your program does not scale because your threads are all competing on locks, often competing when there isn't even an underlying data contention." So said Cliff Click in an earlier discussion on the topic. "JVMs have made huge strides in making locks cheaper and cheaper and cheaper, but ultimately, they cannot make the cost go away."

使用道具 举报

回复
论坛徽章:
350
2006年度最佳版主
日期:2007-01-24 12:56:49NBA大富翁
日期:2008-04-21 22:57:29地主之星
日期:2008-11-17 19:37:352008年度最佳版主
日期:2009-03-26 09:33:53股神
日期:2009-04-01 10:05:56NBA季后赛大富翁
日期:2009-06-16 11:48:01NBA季后赛大富翁
日期:2009-06-16 11:48:01ITPUB年度最佳版主
日期:2011-04-08 18:37:09ITPUB年度最佳版主
日期:2011-12-28 15:24:18ITPUB年度最佳技术原创精华奖
日期:2012-03-13 17:12:05
17#
 楼主| 发表于 2012-7-8 15:20 | 只看该作者
Scaling Java may not be a big problem

Making Java applications scale does not need to be a point of consternation. It won't be necessary to throw away all of those Java applications we've built in the past and replace the whole thing with a .NET framework. The good news is that very few applications ever push the limits of an eight or sixteen processor machine.

Remember, the problem occurs when a large number of processors are fighting over the same few pieces of data. If you've got a number of small, separate, self-contained, individual applications deployed to your multi-core, multi-processor server, you're never going to experience this particular problem with regards to scalability. Any one individual application won't likely put a significant load on any more than a single, or maybe even two of the processors supporting the system, which mean deadlocks and data collisions won't likely be a problem.

So for the vast majority of users, the problem Java applications have with achieving linear scalability is simply a trivial point of interest - something to be brought up at dinner parties or around the water cooler, but not an issue from which an entire enterprise architecture needs to be redesigned. But what if your Java application does hit the limits of linear scalability? Well, there are solutions to the Java scalability paradox, and these are discussed in the second part of this article.

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表