Liferay Portal Performance Best Practices - Samir Bhatt - E-Book

Liferay Portal Performance Best Practices E-Book

Samir Bhatt

0,0
27,59 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Liferay portal is the leading horizontal portal product available in the market. It was named lLeader in Gartner's Magic Quadrant for Horizontal Portals. Because of the flexibility offered by Liferay Portal for customizations, it is becoming a preferred best choice for portal implementations. Many influential sites have been implemented with or have switched to the Liferay portal. More and more Liferay developers and architects are needed in the IT industry.Liferay Portal Performance Best Practices will guide you in how to build high performing Liferay -based solutions. The book guides you on how to define the architecture of Liferay- based solutions to meet performance expectations. You will learn how to fine- tune the Liferay portal using configuration changes or applying the right caching strategy. By the time you finish reading, you will realize that you know all the essential best practices to improve the performance of the Liferay portal solution. The book comprises of Liferay portal performance best practices related to various aspects. It starts with the architecture and design best practices and ends with performance tuning and lLoad testing best practices.

The book follows the logical flow. In the first chapter it talks about various architectural options and best practices. It also talks about the consequences of various architectural options. It talks about how to configure the Liferay portal to work in a clustered environment. It discusses the various options available in a cluster configuration. The book further talks about various configuration options of different components that are available for improving performance. The book also talks about various development best practices. It concludes with best practices related to load testing and a performance tuning exercise.

Liferay Portal Performance Best Practices explains performance best practices with real examples and samples. By the end of this book, the reader will have learned everything he/she needs to know about Liferay portal performance best practices.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 199

Veröffentlichungsjahr: 2013

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Liferay Portal Performance Best Practices
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. Architectural Best Practices
The Liferay Portal reference architecture
The Presentation tier
The Networking tier
The Web tier
The Application tier
The Database Repository tier
The Search Repository tier
The Media Repository tier
The Active Directory tier
Reference architecture characteristics
Scalability
Performance
High availability and fault tolerance
Security
The Deployment sizing approach
The reference hardware
The performance benchmark test summary
An example of sizing calculations
Sample performance requirements
Sizing calculations
The Documents and Media Library architecture
File System and Advanced File System stores
The Database store
The JCR store
The CMIS store
The S3 store
The database architecture
The read/write database
Database sharding
Static content delivery
Content Delivery Network
Content delivery through the web server
The caching architecture
Caching using Ehcache
Ehcache replication using RMI
Ehcache replication using Cluster Link
Caching using Terracotta
Web resource caching using Varnish
The search architecture
Apache Lucene
Index storage on SAN
Lucene Index replication using Cluster Link
Apache Solr
Summary
2. Load Balancing and Clustering Best Practices
The basics of load balancing and clustering with Liferay
Setting up Liferay Portal nodes
Software load balancer configuration using the Apache Web Server
Load balancer configuration using mod_jk
Load balancer configuration using mod_proxy_ajp
Load balancer configuration using mod_proxy_http
Load balancing best practices
Liferay Portal cluster configuration
Session replication configuration
Cache replication
Ehcache replication using RMI
Ehcache configuration using JGroups
Ehcache replication using Cluster Links
Ehcache clustering best practices
Media Library configuration
Network file storage using the Advanced File System store
Database storage using the JCR store
Database storage using DBStore
Media Library clustering best practices
Search engine configuration
Lucene index storage on network storage
Lucene index replication using Cluster Link
Using the Apache Solr search engine
Clustering best practices for the search engine
Quartz scheduler configuration
Summary
3. Configuration Best Practices
Liferay Portal configuration best practices
Servlet filter configuration
The auto login filter
The CAS filter
The NTLM SSO filter
The OpenSSO filter
The SharePoint filter
The GZip filter
The Strip filter
The ValidHtml filter
Auto login hooks
Counter increment
User session tracker
Direct Servlet Context
Plugin repositories
Pingbacks and trackbacks
Google's blog search ping integration
The asset view counter
Document ranks and view count
Scheduler configuration
The Calendar portlet
LDAP integration
The Web Content portlet
The Message Board portlet
The Blogs portlet
The Media Library portlet
The Announcement portlet
Inline permission checks
Lucene Configuration
Application Server configuration best practices
Database connection pool configuration
JVM configuration
Garbage Collection
The Java Heap configuration
JSP engine configuration
Thread pool configuration
Apache Web Server configuration best practices
Static content delivery
GZip compression configuration
Cache header configuration
Apache Web Server MPM configuration
Summary
4. Caching Best Practices
Customizing the Ehcache configuration
Hibernate Ehcache CacheManager
Single-VM CacheManager
Multi-VM CacheManager
Ehcache configuration best practices
Caching using Terracotta
Summary
5. Development Best Practices
UI best practices
Reducing the number of JavaScript files
Reducing the number of CSS files
Using CSS image sprites
Minifying JavaScript files
JavaScript positioning
Limiting the use of DOM operations
Analyzing web page performance using tools
Portlet development best practices
Limiting the use of dynamic queries
Liferay caching API
Coding best practices
Summary
6. Load Testing and Performance Tuning
Getting ready for load testing
Capturing load testing requirements
Selecting load testing tools
Apache JMeter
BlazeMeter
Apache Benchmark (ab)
Preparing load testing scripts
Setting up the load testing environment
Conducting load tests
Resource monitoring and performance tuning
Liferay Portal server – monitoring and tuning
JConsole
VisualVM
JVM – monitoring and tuning
Tomcat thread – monitoring and tuning
Database connection pool – monitoring and tuning
Cache – monitoring and tuning
Apache web server – monitoring and tuning
Monitoring the database server
CPU and memory usage
Slow queries
Connections
Lock monitoring
Monitoring logfiles
Summary
Index

Liferay Portal Performance Best Practices

Liferay Portal Performance Best Practices

Copyright © 2013 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: June 2013

Production Reference: 1030613

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78216-368-8

www.packtpub.com

Cover Image by Faiz Fattohi (<[email protected]>)

Credits

Author

Samir Bhatt

Reviewers

Gaurav Barot

Albert Coronado Calzada

Chintan Mehta

Acquisition Editor

Kartikey Pandey

Commissioning Editor

Harsha Bharwani

Technical Editors

Jalasha D'costa

Amit Ramadas

Project Coordinator

Sneha Modi

Proofreader

Maria Gould

Indexer

Hemangini Bari

Graphics

Abhinash Sahu

Production Coordinator

Aditi Gajjar

Cover Work

Aditi Gajjar

About the Author

Samir Bhatt is an Enterprise Architect with over 12 years of IT experience. He has been working on Liferay-Portal-based solutions for the last four years. He has co-authored a book, Liferay Beginner's Guide by Packt Publishing. He is also a Liferay certified trainer and has delivered public and private training across the world. Samir leads an architectural group at CIGNEX Datamatics. He extensively worked on performance tuning of Liferay-Portal-based solutions. Apart from Liferay Portal, Samir has also worked on many other technologies and frameworks including Hadoop, MongoDB, Pentaho BI, Oracle, Java Swing, ICEfaces, ZK, Spring, Hibernate, and Visual Basic.

Samir is also a very good speaker and has delivered various webinars on Liferay, Pentaho BI, and MongoDB. He blogs at www.connect-sam.com.

I would like to specially thank my mentor and CTO of CIGNEX Datamatics, Munwar Sharif, for encouraging me to write this book.

I sincerely thank the entire Packt Publishing team for providing continuous support throughout this project.

Last but not least, I would like to give a big thanks to my parents, my wife Hetal, and my little daughter Shreeya for supporting and encouraging me throughout the project.

About the Reviewers

Gaurav Barot is a Liferay Architect having 8 years of industry experience, with more than 4 years of experience in Liferay Portal technologies. He has executed Liferay projects in various domains such as media, healthcare, insurance, and so on. He has been involved in the complete life cycle of the project starting from requirement gathering to deployment. He has worked on various versions of Liferay from 5.x to 6.1. He is a certified trainer as well and has provided more than 15 successful private and public training sessions to more than 100 trainees across the globe.

He works with CIGNEX Datamatics, which is a global leader in Open Source technologies. He leads Liferay Practice having nearly 200 members at his organization. Gaurav also co-authored Liferay Beginner's Guide by Packt Publishing.

I would like to thank my parents and my two younger sisters, Kinjal and Yogini, for their love and encouragement. A special thanks to my wife Kruti and my lovely daughter Twisha; both of them have been very tolerant and understanding during all the time I've spent on the computer while reviewing this book.

Albert Coronado Calzada is a highly experienced IT professional with more than 13 years of experience in Java EE, high performance portals, e-commerce, and enterprise software solutions. Albert has completed his Engineering degree in Information Technology and has pursued a Master's in Economic and Financial Management of Companies.

Albert is currently working as a freelance software developer, technical trainer, and consultant for international customers. Albert is an open source software contributor and has released different applications for Liferay and Android.

Albert has also worked on Liferay Beginner's Guide and Instant Liferay Portal 6 Starter by Packt Publishing.

Albert lives in Girona (Spain) and maintains a blog at http://www.albertcoronado.com. You can contact him through Linkedin (es.linkedin.com/in/albertcoronado/) or Twitter (@acoronadoc).

Chintan Mehta has over 10 years of progressive experience in Systems and Server Administration of Linux and open source technologies, along with applications such as Liferay, Alfresco, Drupal, Moodle, Magento, and Compiere. While developing his expertise in these areas, he also enhanced his technical skills in database administration, security, and performance tuning. He heads the Managed Cloud Services practice at CIGNEX Datamatics, and is involved in creating solutions and consulting customers on the cloud. Chintan has done Diploma in Computer Hardware and has a Network certification from a reputed institute in India.

www.PacktPub.com

Support files, eBooks, discount offers and more

You might want to visit www.PacktPub.com for support files and downloads related to your book.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

http://PacktLib.PacktPub.com

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. 

Why Subscribe?

Fully searchable across every book published by PacktCopy and paste, print and bookmark contentOn demand and accessible via web browser

Free Access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

Preface

Liferay is the most popular portal based on open standards, written in Java. It was named Leader in Gartner's Magic Quadrant for Horizontal Portals. Many influential sites have been implemented with or have switched to Liferay Portal. The Liferay platform is highly scalable to serve millions of pages to millions of users on all web browsers, tablets, and mobile devices. We, at CIGNEX Datamatics, have implemented more than 200 large enterprise portals using Liferay since 2006. I was leading Liferay Practice at CIGNEX Datamatics with a staff of 240 Liferay experts. We have tuned many Liferay-based sites, and also trained many administrators and developers in Liferay. This book distills the hands-on approach of my project engagements into a concise, practical book.

Liferay Portal Performance Best Practices will explain to you how to implement high-performing, Liferay-based solutions by following various best practices. The book not only explains the best practices in detail, but also provides the detailed instructions to implement them. By following the logical flow of the chapters, you will learn performance-related best practices that should be followed during the architecture, design, development, deployment, and testing phases. You will also learn best practices for conducting performance tuning activities for a Liferay-based solution. By the end of this book you will have the advanced knowledge to implement a high-performing, Liferay-based solution.

What this book covers

Chapter 1, Architectural Best Practices, talks about the Liferay Portal reference architecture. It talks about various architectural options for implementing high-performing, Liferay-based solutions.

Chapter 2, Load Balancing and Clustering Best Practices, teaches you how to implement load balancing and clustering for a Liferay-based solution. It teaches you about various configuration options for implementing clustering.

Chapter 3, Configuration Best Practices, teaches you various configurations for improving performance of Liferay-based solutions. It talks about performance-related configuration options for the Apache web server, the Tomcat server, Liferay Portal, and so on.

Chapter 4, Caching Best Practices, talks about various options related to caching for improving the performance of Liferay-based solutions. It also teaches you how to configure Liferay Portal with the Terracotta cache server.

Chapter 5, Development Best Practices, talks about some of the key Liferay-specific development practices for developing a high-performing, Liferay-based solution.

Chapter 6, Load Testing and Performance Tuning, teaches you how to perform load testing and performance tuning exercises for a Liferay-based solution. It talks about best practices and guidelines related to load testing and performance tuning. It talks about how to monitor various resources during a load testing exercise in order to fine-tune the solution.

What you need for this book

The following is the software that you will need for Liferay Portal Performance Best Practices.

Liferay Portal 6.1 CE GA2 Tomcat Bundle (http://downloads.sourceforge.net/project/lportal/Liferay%20Portal/6.1.1%20GA2/liferay-portal-tomcat-6.1.1-ce-ga2-20120731132656558.zip)Apache Web Server 2.x (http://httpd.apache.org/download.cgi)MySQL Community Server 5.5.29 (http://dev.mysql.com/downloads/)Terracotta Server Array, with Ehcache and Quartz (http://terracotta.org/downloads/open-source/destination?name=terracotta-3.7.5-installer.jar&bucket=tcdistributions&file=terracotta-3.7.5-installer.jar)

Who this book is for

Developers and architects who already work on Liferay Portal will find this book very useful. Also, system administrators who administer Liferay-Portal-based solutions will find this book very useful.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the erratasubmissionform link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at <[email protected]> with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.

Chapter 1. Architectural Best Practices

The most important aspect that affects the performance of a system is architecture. It is often seen that systems fails to perform as expected because of wrong architectural decisions. Liferay is a leading open source platform for developing high-performing portals. In this chapter, we will focus on the architecture of Liferay-Portal-based solutions. We will learn about various aspects which should be considered while defining the architecture of a Liferay-based solution. By the end of this chapter, we will learn about:

The Liferay Portal reference architectureThe Deployment sizing approachDocuments and Media Library architecture optionsDatabase architecture optionsArchitectural options for handling static resourcesCaching architecture optionsSearch engine architecture options

The Liferay Portal reference architecture

Defining the architecture of a system from scratch requires an enormous amount of effort for researching, investigating, and taking right architectural decisions. We can reduce the effort by referring to the reference architecture for similar kinds of solutions. We can also ensure including a set of architectural best practices from the reference architecture. In this section, we will talk about the reference architecture of Liferay-Portal-based solution. This reference architecture can be used as a base for any Liferay-Portal-based portal solution. Of course, necessary changes have to be made in the reference architecture depending upon specific requirements. The rest of the chapter will help Liferay architects to make the right architectural decisions for such changes.

Here is the reference architecture diagram of Liferay-Portal-based solution:

The Presentation tier

As shown in the previous diagram, users of the portal will access the Portal using tablets, mobile devices, or through PC browsers. Liferay Portal 6.1 supports various devices, and we won't need any special component to render content for mobile devices. Liferay Portal can even detect specific devices and respond with device-specific content. Liferay also supports creating responsive web design using its UI framework called AlloyUI.

The Networking tier

As shown in the reference architecture, every request will pass through Firewall. Firewall will filter unsecure requests. All valid user requests will be passed to the Hardware Load Balancer. The hardware load balancer is a hardware appliance which distributes loads between multiple web servers. The hardware load balancer can also deal with the failure of web servers. In case a of failure of any web server, the hardware load balancer diverts traffic to working web servers. There are a number of hardware load balancers available on the market. Some of the popular hardware load balancer vendors include F5, Cisco, Radware, CoyotePoint, and Barracuda.

The Web tier

The Web tier includes a series of Apache Web Servers. As shown in the reference architecture diagram, each Web Server is connected with each Application Server. The Web Server acts as a Software Load Balancer for Application Servers. Web servers can also act as components to serve static resources. The Apache Web Server connects with the Liferay Portal application server using mod_jk, mod_proxy, or mod_proxy_ajp connectors. These are popular connecters available with the Apache Web Server.

The Application tier

The Application tier includes one or more Liferay Portal application servers. Liferay Portal can be deployed on many different application servers. The reference architecture recommends using the most popular Apache Tomcat Server. Application servers are connected with web servers using the AJP protocol or the HTTP protocol. As shown in the diagram, there is a communication link between Application Servers. Each Application Server is connected with other Application Servers to replicate the session information, and cache and/or search indexes. Each Application Server is connected to dedicated Database Servers and Active Directory Servers.

The Database Repository tier

The Liferay Portal server connects to the Database Repository tier. For production systems, it is advisable to set up multiple database instances with replication. Such a setup ensures high availability of Database Servers. Liferay Portal works with majority of open source and propriety databases. In our reference architecture, we will use MySQL, which is one of the popular open source databases.

The Search Repository tier

Liferay Portal comes with an embedded Apache Lucene search engine. The Lucene search engine stores search indexes in a filesystem. As shown in the reference architecture diagram, each Application Server has its own search index repository in the Search Repository tier. Search engine repositories can be synchronized by the Liferay Portal server using the Cluster Link feature.

The Media Repository tier

Liferay Portal comes with a media repository, which includes a document library, image gallery, and so on. Liferay Portal provides different options to store the media repository content. By default, Liferay stores the media repository content on a filesystem. It can be configured to store the media repository content on a database, Java Content Repository (JCR), CMIS-based repository, or Amazon S3. As shown in the reference architecture diagram, we have used a centralized filesystem to store the media repository content. To avoid issues related to concurrent access on a centralized filesystem, it is recommended to use Storage Area Network (SAN) as the centralized filesystem to store the Media Library content.

The Active Directory tier

Liferay comes with its own user repository. Liferay maintains its user repository in a database. But for production systems, it is recommended to integrate the user repository with identity management systems. The reference architecture refers using the Active Directory server. Liferay Portal connects with the Active Directory Server using the LDAP protocol.

Reference architecture characteristics

In the previous section, we learned about various tiers of the reference architecture. Let's understand how the reference architecture addresses architectural concerns.

Scalability

As shown in the architecture diagram, horizontal scaling is used for both the Web tier and the Application tier. Most of the components in the architecture are decoupled and hence if the user base is increased, we can scale up by adding extra nodes. We can establish linear scalability of the solution by using a performance benchmarking exercise. This can enable us to increase the capacity of the system by increasing 'x' number of Liferay application servers, web servers, or database servers.

Performance

The reference architecture divides the load of the system to multiple tiers. A static resource's requests can be served by the Web tier directly. Also, the Web tier is load balanced using the Hardware Load Balancer. So, the load on each web server is also controlled. Similarly, all application requests will be served by the clustered Application Server tier. The Application Server connects with the Database tier which is again clustered to ensure the load is distributed. The reference architecture ensures that the architecture of the solution is robust enough for delivering high performance.

High availability and fault tolerance

The reference architecture ensures that the most important tiers of the solutions are clustered and load balanced to ensure that the system is highly available and fault tolerant. As shown in the diagram, the Web tier, Application tier, and Database tier are clustered, which means that if any nodes from these tiers go down, the system will still respond to user requests.

Security

The reference architecture places Firewall in