优化CMP性能 in Weblogic with Long-term Caching
作者:anotherbug 日期:2007-09-27 12:41:28
| optimizingcmpperformance.gif(8.3 K) | |
在Weblogic中长期Cache优化CMP性能
Optimizing CMP Performance in Weblogic with Long-term Caching
Not very popular choice for persistence nowadays, CMP still too often is only
readily available persistence framework in Enterprise environment. While not
as sexy as hibernate or href="http://www.ibatis.com/common/sqlmaps.html" target="_blank">SQL Maps, CMP 2.X implementation
in leading application servers such as BEA href="http://www.bea.com/framework.jsp?CNT=index.htm&FP=/content/products/server/" target="_blank">Weblogic offers
quite good solution for ORM problems. Beside there is a lots of developers
familiar with EJB and mature support from different tools from href="http://xdoclet.sourceforge.net" target="_blank">xdoclet to Eclipse href="http://eclipse.org/webtools/index.html" target="_blank">wtp/jst.
Let's
take a look at what can be done to improve performance of CMP in Weblogic
by enabling more aggressive than default caching strategies.
Everybody knows that EJB Container maintains cache or pool of Entity Beans,
usually configurable in deployment descriptor. Amazingly lots of developers
don't realize that it doesn't mean that once Container loaded particular bean
instance from database it won't go to database again while bean instance is
kept in pool. Quite contrary, by default Container calls ejbLoad() to
synchronize instance's state from the database at the beginning of every transaction.
Basically on every operation with CMP bean, even if bean was loaded seconds
ago in previous transaction Container executes SQL select to refresh it. Only
while you operating with CMP instance(s) in one transaction Container caches
them. This is so called 'Commit Options A/B/C' as described in EJB 2.0 specification
(10.5.9).
Obviously reloading state from database in every transaction could have some
performance impact. Easy to understand why this is default behavior - this
is safest way if database shared between multiple processes and each one of
them could change state of persisted object in database while it's cached in
EJB pool. In this case we're facing possibility of lost updates - other process
updates record in database and then Container overwrites it with potentially
stale data from cache. But first of all refreshing data in the beginning of
transaction doesn't guarantee against lost updates, it's just reduces possibility
of it. This is a well know problem in database world and there are two approaches
to deal with it. First approach is so called 'pessimistic concurrency locking',
when records in database locked for other updaters for duration of transaction
('select for update'). This is almost never used because of significant overhead
and performance impact. Second approach is called 'optimistic concurrency locking',
in this case there is no actual locks held in database but process which execute
update has some mechanism to detect that record been updated by other process
between his read and update. Preferred way to implement this is with 'version'
column on the database table (in SQL update increment value for that column,
include previous value in 'where' clause and then detect if no rows are updated).
Weblogic has href="http://e-docs.bea.com/wls/docs81/ejb/entity.html#1168097" target="_blank">built in support
for optimistic concurrency in CMP beans via href="http://e-docs.bea.com/wls/docs81/ejb/DDreference-cmp-jar.html#1114366" target="_blank">verify-columns element
in weblogic-cmp-rdbms-jar.xml deployment descriptor. It is a good practice
to have 'version' column in all (updatable) tables in your database and configure
CMPs to use it by enabling optimistic concurrency in href="http://e-docs.bea.com/wls/docs81/ejb/DDreference-ejb-jar.html#1113345" target="_blank">concurrency-strategy element
in weblogic-ejb-jar.xml
Optimistic concurrency alone doesn't give you any performance improvement,
but it's necessary step to enable href="http://e-docs.bea.com/wls/docs81/ejb/entity.html#1195723" target="_blank">cache-between-transactions functionality
which is not available without enabling optimistic concurrency (for the reasons
discussed above). Setting cache-between-transactions to 'true' will result
in Container skipping calls to ejbLoad() if bean instance is already
available in the EJB cache. For certain types of applications where the same
objects accessed more than once from different transactions over short period
of time this can lead to significant performance improvements (in our tests
up to 30% for our application).
Naturally your application must be ready to deal with OptimisticConcurrencyException when
concurrency violation is detected by container. When OptimisticConcurrencyException (subtype
of RuntimeException) is thrown Container discards EJB instance from cache.
In a cluster, when a bean with Optimistic concurrency is updated, notifications
are broadcast to other cluster members to prevent optimistic conflicts. Note
that if you have href="http://e-docs.bea.com/wls/docs81/ejb/DDreference-ejb-jar.html#1113474" target="_blank">delay-updates-until-end-of-tx set
to 'true' (default) your code won't see optimistic exception until transaction
commit.
Word of caution. While available for quite a long time, cache-between-transactions
functionality never worked stable in Weblogic 7, but it seems to be fixed in
version 8.1. We're using it in production applications and quite happy with
the results.
About the author
Dmitri Maximovich
Blog: http://www.jroller.com/page/maximdim
Dmitri Maximovich is an independent consultant specializing in software design, development, and technical training. He has more than twelve years of industry experience and has been involved with J2EE since its inception. His job profile includes designing and developing mission critical applications for financial and pharmaceutical industries.
Dmitri lives in Toronto, Canada and has a master's degree in Physics from St. Petersburg university.
订阅
上一篇
|

文章来自:
标签: 





美图
追月
笑话
搞笑
星座
测试
游戏
女性
诱惑
财经
美女
jianyang
TCM
Diabeat
jimpness beauty
furunbao
星座
TCM
Diabeat
变易
TCM
Diabeat
起名公司
虚拟主机
网站建设
北京seo
网站优化
电脑维修
垃圾桶
垃圾箱
果皮箱
分类垃圾桶
分类垃圾箱
环卫用品
物业采购
北京租车
北京租车服务
http://www.interbd.com 出会い系サーチ
http://www.zappeduster.com 出会い系サイトFreedom
http://www.grupopenelope.com セフレPlaySpot
http://www.42plus.com メル友無料募集サイト
http://www.brv-inc.com 人妻がハマる出会い系
http://www.meditacija.net 不倫人妻秘密サークル
http://www.aec-dk.com/ ご近所の人妻探し
http://www.mb-friends.net/ セフレ伝説-セフレ探し専門サイト-
http://seo-mobi.net/jk/ 女子高生!
http://www.hmt-ag.com/ ご近所の出会い探し
http://www.biotechcgi.com/ 出会い放題
http://www.hi-tech-reno.com/ 素敵な恋人探し
http://www.mb-deai.net/ 人妻DX
http://www.littlediablo.net/ 出会いの森
http://www.ccc-p.com/ 出会い系オンリー
http://www.sit-n-shop.com/ メル友ちぇき!
http://www.mtdcases.com/ セフレステーション
http://www.louisville-realtor.com/ 人妻Magic!!
http://www.heartminders.com/ 不倫ありませんか!
http://www.targetvehiclerental.com/ ピンクの恋人
http://www.mail24x7.com/00/idkb0022.html プチ家出掲示板NO.1!リターンズ
http://www.kessel-diamonds.com スタビLuxury
http://sincerely-love.com/00 セックスフレンド無料サイト-プレミアム
http://www.cambridgeins.com/ セックスフレンド大陸
http://www.lots-ins.com/ ご近所のアイシテル!
http://www.chihuahuaelpub.com/ 出会い探し
http://www.aec-dk.com/merutomo/ ご近所のメル友探し
http://www.andritz-na.com/merutomo/ メル友を探そう
http://www.hi-tech-reno.com/merutomo/ 素敵なメル友探し
http://www.sugudeai.com/ 出会い系案内所
qinxl5201
wow gold
wow gold
wow gold
wow gold
wow power leveling
wow power leveling
warhammer gold
wowmine.com
空调
空调
空调
海尔空调
海尔空调
海尔空调
商用中央空调
商用中央空调
商用中央空调
韩语培训
韩语培训
韩语培训
上海韩语培训
上海韩语培训
上海韩语培训
人力资源管理师
人力资源管理师
人力资源培训
人力资源培训
英语口语
英语口语
人力资源管理师
人力资源管理师
人力资源培训
人力资源培训
wow gold
wow gold
wow gold
wow gold
wow gold
wow gold
wow gold
wow gold
wow gold
wow gold
wow gold
wow gold
wow gold
wow gold
wow gold
dofus kamas
kamas dofus
dofus kamas
kamas dofus
dofus kamas
kamas dofus
dofus kamas
kamas dofus
dofus kamas
kamas dofus
wow leveling
Runescape Money
Runescape Gold
Runescape Money
Runescape Gold
Runescape Power leveling
Runescape Money
Runescape Gold
Runescape gold
runescape money
Runescape Money
Runescape gold
Runescape Money
Runescape gold
Runescape Power leveling
Runescape Items
runescape money
runescape gold
money runescape
Runescape Money
Runescape gold
Runescape Gold
runescape money
age of conan gold
aoc power leveling
age of conan power leveling
aoc leveling
age conan gold
archlord gold
buy archlord gold
anarchy online credits
anarchy online credit
city of heroes influence
coh influence
city of villains infamy
cov infamy
dofus kamas
kamas dofus
eve isk
eve online isk
everquest 2 gold
eq2 plat
ffxi gil
final fantasy xi gil
buy ffxi gil
gaia online gold
gaia gold
guild wars gold
gw gold
hellgate london palladium
cabal alz
daoc gold
daoc plat
world of warcraft gold
wow po
wow or
buy wow gold
cheap wow gold
wow power leveling
wow powerleveling
world of warcraft gold
wow po
wow or
cheap wow gold
wow power leveling
wow powerleveling
buy wow gold
dofus kamas
kamas dofus
Lord of the Rings Online Gold
LOTRO Gold
LOTR Gold
age of conan gold
age conan gold
age of conan power leveling
aoc gold
aoc power leveling
aoc leveling
Maple Story meso
Maple Story Mesos
maplestory Mesos
fly for fun penya
flyff penya
buy flyff gold
flyff money
Final Fantasy XI gil
ffxi gil
buy ffxi gil
buy Warhammer gold
Warhammer gold
silkroad online gold
SRO gold
Silkroad gold
buy silkroad gold
world of warcraft gold
wow gold kaufen
buy wow gold
wow geld
cheap wow gold
wow power leveling
wow powerleveling
dofus kamas
kamas dofus
Lord of the Rings Online gold
LOTR gold
LOTRO gold
age of conan gold
age conan gold
age of conan power leveling
aoc gold
aoc power leveling
aoc leveling
Maple Story meso
Maple Story Mesos
maplestory Mesos
fly for fun penya
flyff penya
buy flyff gold
flyff money
Final Fantasy XI gil
ffxi gil
buy ffxi gil
buy Warhammer gold
Warhammer gold
silkroad online gold
SRO gold
Silkroad gold
buy silkroad gold
world of warcraft gold
wow po
wow or
buy wow gold
cheap wow gold
wow power leveling
wow powerleveling
dofus kamas
kamas dofus
Lord of the Rings Online Gold
LOTRO Gold
LOTR Gold
age of conan gold
age conan gold
age of conan power leveling
aoc gold
aoc power leveling
aoc leveling
Maple Story meso
Maple Story Mesos
maplestory Mesos
fly for fun penya
flyff penya
buy flyff gold
flyff money
ffxi gil
Final Fantasy XI gil
buy ffxi gil
silkroad online gold
SRO gold
Silkroad gold
buy silkroad gold
buy Warhammer gold
Warhammer gold
world of warcraft gold
wow po
wow or
buy wow gold
cheap wow gold
wow power leveling
wow powerleveling
dofus kamas
kamas dofus
Lord of the Rings Online Gold
LOTRO Gold
LOTR Gold
age of conan gold
age of conan power leveling
age conan gold
aoc gold
aoc power leveling
aoc leveling
Maple Story meso
Maple Story Mesos
maplestory Mesos
fly for fun penya
flyff penya
buy flyff gold
flyff money
ffxi gil
buy ffxi gil
Final Fantasy XI gil
buy cheap ffxi gil
buy Warhammer gold
Warhammer gold
silkroad online gold
SRO gold
Silkroad gold
buy silkroad gold
world of warcraft gold
wow po
wow or
buy wow gold
cheap wow gold
wow power leveling
wow powerleveling
dofus kamas
kamas dofus
Lord of the Rings Online Gold
LOTRO Gold
LOTR Gold
age of conan gold
age conan gold
age of conan power leveling
aoc gold
aoc power leveling
aoc leveling
Maple Story meso
Maple Story Mesos
maplestory Mesos
fly for fun penya
flyff penya
buy flyff gold
flyff money
ffxi gil
buy ffxi gil
Final Fantasy XI gil
buy cheap ffxi gil
buy Warhammer gold
Warhammer gold
silkroad online gold
SRO gold
Silkroad gold
buy Silkroad gold
The joyous Mid-Autumn Festival was celebrated on the fifteenth day ffxi gilof the eighth moon, around the time of the autumn equinox. Many referred to it simply as the "Fifteenth of the Eighth Moon".
This day was also considered as wow golda harvest festival since fruits, vegetables aoc goldand grain had been harvested by this time and food was abundant.
Food offerings were placed on an altar set up in the courtyard. Apples, pears, peaches, wow goldgrapes, pomegranates, melons, oranges and pomelos might be seen. Special foods for
maple story mesosthe festival included moon cakes, cooked taro and water caltrope, a type of water chestnut maplestory mesosresembling black buffalo horns.
Some people insistedmaple story meso that cooked taro be included because at the time of creation, taro was the first food discovered at night in the moonlight. Of allthese foods, it could not
be omitted from wow goldthe Mid-Autumn Festival.The round moon cakes, measuring about three inches in diameter and one and a half aoc goldinches in thickness,
resembled Western fruitcakes in taste and consistency. These wow goldcakes were made with melon seeds, lotus seeds, almonds, minced meats, bean wow goldpaste,
orange peels and lard. A golden yolk from a salted duck egg was placed at the wow goldcenter of each cake, and the golden brown crust was decorated with symbols of the festival. Traditionally,
thirteen moon cakes were piled in a pyramid to symbolize the thirteen moons of a "complete year," that is, twelve moons plus one intercalary moon. The Mid-Autumn Festival is a traditional wow goldfestivity
for both the Han and minority nationalities. The custom of worshipping the moon can be traced back as far as the ancient Xia wow goldand Shang Dynasties (2000 B.C.-1066 B.C.). In the Zhou Dynasty(1066 B.C.-221 B.C.),
people hold ceremonies to greet winter and worship the moon whenever the Mid-Autumn Festival sets in. It becomes very wow goldprevalent in the Tang Dynasty(618-907 A.D.) that people enjoy and worship the full moon.
In the Southern Song wow goldDynasty (1127-1279 A.D.), however, people send round moon cakes to their relatives as gifts in expression of their best wishes of wow goldfamily reunion.
When it becomes dark, they look up at the full silver moon or go sightseeing on lakes to celebrate the festival. Since the Ming (1368-1644 A.D. ) and Qing Dynasties (1644-1911A.D.), thewow gold custom of Mid-Autumn
Festival celebration becomes unprecedented popular. Together with the celebration there appear some special wow goldcustoms in different parts of the country, such as burning incense, planting Mid-Autumn trees, lighting
lanterns on towers and fire dragon dances. However, the custom of playing under the moon is not so popular as it used to be nowadays, but it is not less popular to enjoy the bright silver moon. Whenever the festival sets in, people will look up at
the wow goldfull silver moon, drinking wine to celebrate their happy life or thinking of their relatives and friends far from home,and extending all of their best wishes to them.
maple story mesosmaplestory mesosmaple story mesoffxi gilwow levelingwow power levelingwow powerlevelingwow goldwow power levelingwow powerlevelinghero online goldimvu creditskal geonknight goldlast chaos goldlineage adenalineage 2 adenalord of the rings goldlotro goldlotr goldmaple story mesosmaplestory mesosmaplestory mesoperfect world goldpirates of the burning Sea gold voyage century gold DOTA6.51地图下载 DOTA6.54地图下载 Warhammer gold Warhammer gold Warhammer gold
上海翻译
太阳能路灯
英语培训
英语口语
藏獒
防腐管道
液压缸
油缸
移民
投资移民
加拿大移民
技术移民
移民加拿大
澳洲技术移民
德国移民
移民澳洲
澳洲移民
出国移民
移民出国
英国移民
澳大利亚移民
加拿大投资移民
加拿大技术移民
北京旅游
北京旅行社
条码机
条码打印机
条形码打印机
防腐设备
煤气发生炉
美国留学
法国留学
法国留学
北欧留学
瑞典留学
芬兰留学
澳洲留学
除湿机
抽湿机
工业除湿机
空气净化器
空气净化机
美术培训
美术高考
美术高考培训
画室
北京画室
谐波治理
无功补偿