六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 219|回复: 0

Liferay性能调优

[复制链接]

升级  9%

67

主题

67

主题

67

主题

举人

Rank: 3Rank: 3

积分
227
 楼主| 发表于 2013-2-7 23:28:01 | 显示全部楼层 |阅读模式
CONTRIBUTIONS WANTED Corné|Corné 03:14, 19 November 2007 (PST)

The aim of this article is to collect performance enhancing tweaks,tips and techniques.

Startup
##Lucene Search
#Set the following to true if you want to index your entire library of files on startup.
index.on.startup=false
General performance
System.properties;

# The layout cache filter will cache pages to speed up page rendering for
# guest users. See ehcache.xml to modify the cache expiration time to live.
com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter=true
Minimize output

HTML
Saves some 50Kb on every page but portlet look-feel modification is not possible for all (including (Omni)Admin)

## Portlet CSS Portlet
# Set this to true to enable the ability to modify portlet CSS at runtime
# via the Look and Feel icon. Disabling it can speed up performance.
portlet.css.enabled=false
JAVASCRIPT
Not needed scripts could be expunged here. But the fattest of them all jQuery is needed almost always

## JavaScript
# Set a list of JavaScript files that will be loaded programmatically in
# /html/common/themes/top_js.jsp.
#
# The ordering of the JavaScript files is important. Specifically, all
# JQuery scripts should go first.
#
# The Liferay scripts are grouped in such a way, that the first grouping
# denotes utility scripts that are used by the second and third groups. The
# second grouping denotes utility classes that rely on the first group, but
# does not rely on the second or third group. The third grouping denotes
# modules that rely on the first and second group.
#
javascript.files= .....

Setting this will improve download time, but tweaks above are probably unused

## JavaScript
# Set this property to true to load the combined JavaScript files from the
# property "javascript.files" into one compacted file for faster loading for
# production. Set this property to false for easier debugging for
# development. You can also disable fast loading by setting the URL
# parameter "js_fast_load" to "0".
javascript.fast.load=true
CSS
## Theme
# Set this property to true to load the theme's merged CSS files for faster
# loading for production. Set this property to false for easier debugging
# for development. You can also disable fast loading by setting the URL
# parameter "css_fast_load" to "0".
theme.css.fast.load=true

RESOURCES
Get your images and other resources from your personalised theme or even an HTTP server alias like www.liferay.org/resources/ Resources uploaded in Liferay are being served-up from database and will always be slower than using this strategy. especialy for recurring enterprise logo's and all.
THEMES
If you need a high performing landing-page and other pages you could consider creating a special theme for these pages.
VELOCITY CACHING
    # Set this to true in production so that VM templates are cached
    velocity.engine.resource.manager.cache.enabled=true

CSS
Hack removing ALL CSS

edit templates\portal_normal.vm;

<head>
#if ( $is_signed_in )
  #css ($css_main_file)  
#end
</head>
JAVASCRIPT
Hack removing ALL scripts en catching script exceptions LR 4.3.4

edit templates\portal_normal.vm;

<head>
  <title>$company_name - $the_title</title>
#if ( $is_signed_in && ($permissionChecker.isOmniadmin() )  )
   $theme.include($top_head_include)
#else
  <script type="text/javascript">
    // hack catching exceptions
    Liferay = function() {return {};}();
    Liferay.Portlet = {
     isAjax: function(id) {return true;},
     process: function(id) {}
    };
    Liferay.Session = {init: function(params) {}};
  </script>
#end
#css ($css_main_file)  
#if ( $is_signed_in && ($permissionChecker.isOmniadmin() )  )
   #js ($js_main_file)
  #end
</head>
only use $is_signed_in for all signed in users/admin's

$is_signed_in
Database
MySQL:
Links to useful references:

A good sample my.cnf: http://www.theadminzone.com/forums/showthread.php?t=8150
Optmization, understanding mysql: http://www.mysqlperformanceblog.com/files/presentations/UC2005-Advanced-MySQL-Performance-Optimization.pdf
MySQL Performance Tuning Primer Script: http://day32.com/MySQL/

General SQL: clustering databases

Sequoia

Sequoia is a transparent middleware solution offering clustering, load balancing and failover services for any database. Sequoia is the continuation of the C-JDBC project. The database is distributed and replicated among several nodes and Sequoia balances the queries among these nodes. Sequoia handles node and network failures with transparent failover. It also provides support for hot recovery, online maintenance operations and online upgrades.

http://sequoia.continuent.org/HomePage


Browser
Firefox

If you're serving content using SSL, open the URL

   about:config
Locate the value:

   browser.cache.disk_cache_ssl
Double-click to set value to true

Without this setting, each and every page load will reload all the images and CSS, making pages load about 5 times slower.



Application Server
WebSphere:

   Enable Servlet Caching & Dynamic Caching.
Dynamic Caching:

http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/tdyn_enablecache.html

Servlet Caching:

http://publib.boulder.ibm.com/infocenter/wasinfo/v5r1''index.jsp?topic=/com.ibm.websphere.zseries.doc/info/zseries/ae/tdyn_servletcaching.html''

Optional: Create a cachespec.xml to cache dynamic content:

http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/tdyn_dynamiccacheconfig.html (Without a cachespec.xml only static content is cached, but are there any dynamic jsps with a constant static output?)

But be careful, these settings need a powerful Application Server.

Improvement: Approxamately 50% faster

Probably this works also with other Application Servers like Tomcat...

Related Articles
Checklist for Getting Your Website Ready for Production
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表