SlideShare uma empresa Scribd logo
1 de 35
Baixar para ler offline
Building a high
performance directory
server in Java
Lessons learned and tips
from the OpenDS project.
Ludovic Poitou
Matthew Smith
Sun Microsystems
#118
AGENDA

> Introduction to the OpenDS project
> Architecture, Design Patterns and Tips
> Experiences with Sun JVM
> Conclusion




                                           2
AGENDA

> Introduction to the OpenDS project
> Architecture, Design Patterns and Tips
> Experiences with Sun JVM
> Conclusion




                                           3
The OpenDS Project




> Released in Open Source in July 2006
  – CDDL
   –   Source code at https://opends.dev.java.net/
> Sponsored by Sun Microsystems
> Written in Java by LDAP experts
What is it ?
> OpenDS is effectively a Java based Server supporting the LDAPv3 protocol and
  services
  – Objet Oriented, Hierarchical Data Model
   –   CRUD operations
> It comes with its own embedded database
  – Based on Berkeley DB Java Edition
   –   Not accessible from outside
> It has all security, access controls, password management features to safely
  store the information about Users
What is it for ?
> Generic object oriented data store
> White pages and Email Address Book
> Mostly the data store for Identities
  – For Authentication and Authorization
   –   For profiles and personalization
> The underlying infrastructure in all Enterprises
  – Leveraged by Web and Mail infrastructure products
   –   Cornerstone of Identity Management products:
                 Access Management and Federation
                 Provisioning and De-provisioning tools
Who for ?
> Telecom service providers, financial institutions use LDAP directories for
  customer related services (Portal)
  – Storing customers identities, phones, services associated
   –   Building highly available services for 10 Millions, up to 200 Millions users
> But OpenDS can be used as OS naming service, or for SMB
  – OpenSolaris, Solaris, Linux...
   –   Coupled with SAMBA, as a Domain controler
   –   Integrated with Kerberos
   –   White Pages...
> And being 100% pure Java, OpenDS can be embedded in other Java
  applications or Web applications
  – OpenSSO


                                                                                      7
OpenDS 2.2
> Released in December 2009
> LDAPv3 directory server fully standard compliant
   –   Supports many LDAP standard and experimental extensions
   –   Supports Multi Master Replication with 3 different levels of data consistency
   –   Extensive security features
> Improved performances, reliability over OpenDS 1.0
> Installs in 6 clicks and less than 3 minutes
> Several GUI and CLI to manage, monitor the OpenDS server
> Extensive documentation
> Localized in 6 different languages
Performance characteristics
> As for most servers, scalability is extremely important
  – Up to hundreds million of entries
   –   Up to thousands connections
   –   Maximize use of CPUs
> What is the operations throughput ?
> What is the average response time ? The maximum response time ?
> Our basic test
  – 10 M entries, with an average size of 2.6K
   –   2 servers, with Multi-Master replication between them
Searchrate on Sun x4170 box
Modrate on a Sun x4170 box
AGENDA

> Introduction to the OpenDS project
> Architecture, Design Patterns and Tips
> Experiences with Sun JVM
> Conclusion




                                           12
How to reach those results ?
> 2 main aspects
  – Architecture and code
   –   Run-time : JVM and Garbage Collector optimization
> There is a strong relationship between code design and memory optimization
Architecture Overview
Patterns
> Use of Asynchronous I/O
  – Exception for write disk transactions
> Use of Immutable Objects
  – Intrinsic thread safety
   –   Avoid need for defensive copies
> Use of “Factories” over Constructors
  – Avoid creating an object
   –   Ease optimization for common cases
                Example : Most AttributeDescriptions have 0 options
                Example : Attributes generally have 1 value
   –   For immutable objects.




                                                                       15
Patterns
> Producers / Consumers
  – Queues
  –   Thread Pool
  –   Monitors
> Strategies
  – Queue Strategies : ConcurrentLinkedQueue vs LinkedBlockingQueue




                                                                      16
Anti-Patterns
> String concatenation
  – Make sure to use a StringBuilder
   –   Compiler now optimize simple “Aaa” + “Bbb” concatenation
> Avoid very long methods (thousands of lines of code)
> Avoid exposing the concrete representation of an object
   –   Set vs LinkedHashSet.
   –   Not a performance issue, but will require more work when optimizing code
       for performance later
> Try to define only the methods you need.




                                                                              17
Java Collections
> Vector and Hashtable are synchronized for all methods
  – Pay the price even if not necessary
> Some Java collection classes are not synchronized by default
  – ArrayList, LinkedList replace Vector
   –   HashSet, HashMap replace Hashtable
> To synchronize, wrap in a class
> With a “static factory”
   –   Collections.synchronizedList(new ArrayList())
> ConcurrentHashMap, for concurrency
  – But watch when using the iterator




                                                                 18
Critical Sections
> Try to minimise the code and time spent in the critical sections
> But the throughput is limited by the time spent in the largest critical section
   –   Example : LinkedBlockingQueue
                 200 000 operations on x64 processor
                 20 000 operations on the T2000 processor
   –   We use it for the WorkQueue and Access Logs
Caching data
> Using Caches reduce the disk access thus should provide better performances
> But cache eviction add pressure to the GC
   –   When modifying entries
   –   When the cache is too small to hold all data
> A cache is also a contention point
> If you want to cache objects, make sure you cache those that will be reused.
> Alternate possibility, use “thread local” cache.
  – But watch out for the cost (with 1000 threads?)
Server monitoring
> Getting statistics for a server is mandatory
> Beware of contention
   –   Stats are updated frequently
   –   But seldom read
> A strategy could be to keep per thread statistics and collect them on demand
  – Not yet implemented in OpenDS !
AGENDA

> Introduction to the OpenDS project
> Architecture, Design Patterns and Tips
> Experiences with tuning Sun JVM
> Conclusion




                                           22
Performance Tuning

> When dealing with performances, you should consider the whole system
  – Java VM
   –   OS
   –   Hardware : CPU, Memory, Disks, Network...
> In our case, we try to avoid disk I/Os
  – And try to cache as much of the database
> We also want deterministic response times
  – Avoid any Full GC (Stop The World)
   –   Make sure minor GC pauses are as small as possible




                                                                         23
JVM Tuning for OpenDS
> Super Size The Heap !
  – We use 32GB Heaps, sometime
     up to 96GB
  – 2GB for the New Generation (or
     ¼ of heap if < 8GB)
  – -Xms32768M -Xmx32768M
     -Xmn2048M
> Use CMS
  –   -XX:+UseConcMarkSweepGC
  –   -XX:+UseParNewGC
> -XX:MaxTenuringThreshold=1
  – Avoid copy of objects in New Gen


                                       24
Some interesting JVM Options
> -XX:CMSInitiatingOccupancyFraction=70
  – Define the amount of occupancy in Old Gen before starting to collect
   –   Larger = better throughput but higher full GC risk
> -XX:+UseCompressedOops
  – For 64bits JVM, less than 32BG of heap
   –   Will be the default in coming Java 6 updates
> If running on processor with NUMA architecture
  – -XX:+UseNUMA
> -XX:+AggressiveOpts
  – Enables aggressive JIT optimizations, not related to GC



                                                                           25
The Garbage First (G1) GC
> Introduced in the Java HotSpot VM in JDK 7.
> An experimental version of G1 has also been released since Java SE 6 Update
  14.
> G1 is the long-term replacement for HotSpot's low-latency Concurrent Mark-
  Sweep (CMS) GC
> Should be officially supported with Java SE 6 Update 21




                                                                          26
G1 Characteristics
> Future CMS Replacement
  – Server “Style” Garbage Collector
   –   Parallel, Concurrent
   –   Generational
   –   Good Throughput
   –   Compacting
   –   Improved ease-of-use
   –   Predictable (though not hard real-time)
> The main stages consist of remembered set (RS) maintenance, concurrent
  marking, and evacuation pauses.




                                                                           27
JVM Options With G1
> -XX:+UnlockExperimentalVMOptions
  -XX:+UseG1GC
> PauseTime (Hints, Goal with no promise, otherwise use Java Real Time )
   –   -XX:MaxGCPauseMillis=50 (target of 50 milliseconds)
   –   -XX:GCPauseIntervalMillis=1000 (target of 1000 msecs)
> Generation Size
  – -XX:+G1YoungGenSize=512m (for a 512 MB young gen)
> Parallelism
  – -XX:+G1ParallelRSetUpdatingEnabled
   –   -XX:+G1ParallelRSetScanningEnabled




                                                                           28
OpenDS et G1
> Goal: Avoid any Full GC, best control of pauses
> Collaboration between the HotSpot and the OpenDS teams
   –   OpenDS is used as a “Large” reference application
   –   Between 10 and 20 enhancements integrated in G1 following the tests
   –   Performance with large heaps improved by a factor of 10
> We're still discovering it
  – When doing read operations, we see pauses between 10 and 20 ms with
     32GB JVM
  – But we're still seeing Full GC when doing Write operations (More garbage,
     stresses more the Old Gen)
  – Hopefully this will be resolved in next builds



                                                                             29
OpenDS G1 and Searches




                         30
AGENDA

> Introduction to the OpenDS project
> Architecture, Design Patterns and Tips
> Experiences with Sun JVM
> Conclusion




                                           31
Summary
> OpenDS
  – A open source LDAP directory server, 100% pure Java
   –   Easy to install and use
   –   Designed for high performance and high scalability
> We saw some patterns and tips used in the OpenDS project
> Knowing and understanding the JVM and GC is required to build high
  performance server
  – Tuning JVM and GC is an art
   –   Performance engineering is a profession
> Who said that Java is slow ?!




                                                                       32
The Art of GC Tuning




           JavaOne Presentation: GC Tuning in HotSpot JVM
      http://developers.sun.com/learning/javaoneonline/j1sessn.jsp?sessn=TS-4887&yr=2009&track=javase



                                                                                                        33
Now...
> Give OpenDS a try
  – http://www.opends.org
> Join our community:
  – Join/Login sur Java.net
   –   http://opends.dev.java.net
   –   Request a Role
   –   Subscribe to the mailing lists
   –   IRC: #opends on freenode.net
> OpenDS is localized in several
  languages. It's community based,
  through online tools. An easy way to
  participate.


                                         34
Ludovic Poitou     blogs.sun.com/Ludo
Sun Microsystems   Ludovic.Poitou@sun.com


Matthew Swift
Sun Microsystems   Matthew.Swift@sun.com

Mais conteúdo relacionado

Mais procurados

Introduction to Galera
Introduction to GaleraIntroduction to Galera
Introduction to GaleraHenrik Ingo
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability Mydbops
 
Query Optimization with MySQL 8.0 and MariaDB 10.3: The Basics
Query Optimization with MySQL 8.0 and MariaDB 10.3: The BasicsQuery Optimization with MySQL 8.0 and MariaDB 10.3: The Basics
Query Optimization with MySQL 8.0 and MariaDB 10.3: The BasicsJaime Crespo
 
Galera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction SlidesGalera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction SlidesSeveralnines
 
High performance and high availability proxies for MySQL
High performance and high availability proxies for MySQLHigh performance and high availability proxies for MySQL
High performance and high availability proxies for MySQLMydbops
 
Automate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with AnsibleAutomate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with AnsibleFederico Razzoli
 
MySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Server Backup, Restoration, and Disaster Recovery PlanningMySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Server Backup, Restoration, and Disaster Recovery PlanningLenz Grimmer
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcachedJurriaan Persyn
 
Building better Node.js applications on MariaDB
Building better Node.js applications on MariaDBBuilding better Node.js applications on MariaDB
Building better Node.js applications on MariaDBMariaDB plc
 
Introduction to XtraDB Cluster
Introduction to XtraDB ClusterIntroduction to XtraDB Cluster
Introduction to XtraDB Clusteryoku0825
 
[db tech showcase Tokyo 2014] B15: Scalability with MariaDB and MaxScale by ...
[db tech showcase Tokyo 2014] B15: Scalability with MariaDB and MaxScale  by ...[db tech showcase Tokyo 2014] B15: Scalability with MariaDB and MaxScale  by ...
[db tech showcase Tokyo 2014] B15: Scalability with MariaDB and MaxScale by ...Insight Technology, Inc.
 
MyDUMPER : Faster logical backups and restores
MyDUMPER : Faster logical backups and restores MyDUMPER : Faster logical backups and restores
MyDUMPER : Faster logical backups and restores Mydbops
 
MySQL Performance Tuning Variables
MySQL Performance Tuning VariablesMySQL Performance Tuning Variables
MySQL Performance Tuning VariablesFromDual GmbH
 
Maxscale_메뉴얼
Maxscale_메뉴얼Maxscale_메뉴얼
Maxscale_메뉴얼NeoClova
 
InnoDB Performance Optimisation
InnoDB Performance OptimisationInnoDB Performance Optimisation
InnoDB Performance OptimisationMydbops
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresFederico Razzoli
 

Mais procurados (20)

Introduction to Galera
Introduction to GaleraIntroduction to Galera
Introduction to Galera
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
 
Query Optimization with MySQL 8.0 and MariaDB 10.3: The Basics
Query Optimization with MySQL 8.0 and MariaDB 10.3: The BasicsQuery Optimization with MySQL 8.0 and MariaDB 10.3: The Basics
Query Optimization with MySQL 8.0 and MariaDB 10.3: The Basics
 
Galera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction SlidesGalera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction Slides
 
NoSQL with MySQL
NoSQL with MySQLNoSQL with MySQL
NoSQL with MySQL
 
High performance and high availability proxies for MySQL
High performance and high availability proxies for MySQLHigh performance and high availability proxies for MySQL
High performance and high availability proxies for MySQL
 
Automate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with AnsibleAutomate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with Ansible
 
MySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Server Backup, Restoration, and Disaster Recovery PlanningMySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Server Backup, Restoration, and Disaster Recovery Planning
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
Building better Node.js applications on MariaDB
Building better Node.js applications on MariaDBBuilding better Node.js applications on MariaDB
Building better Node.js applications on MariaDB
 
Introduction to XtraDB Cluster
Introduction to XtraDB ClusterIntroduction to XtraDB Cluster
Introduction to XtraDB Cluster
 
[db tech showcase Tokyo 2014] B15: Scalability with MariaDB and MaxScale by ...
[db tech showcase Tokyo 2014] B15: Scalability with MariaDB and MaxScale  by ...[db tech showcase Tokyo 2014] B15: Scalability with MariaDB and MaxScale  by ...
[db tech showcase Tokyo 2014] B15: Scalability with MariaDB and MaxScale by ...
 
MyDUMPER : Faster logical backups and restores
MyDUMPER : Faster logical backups and restores MyDUMPER : Faster logical backups and restores
MyDUMPER : Faster logical backups and restores
 
Memcached Study
Memcached StudyMemcached Study
Memcached Study
 
Java GC, Off-heap workshop
Java GC, Off-heap workshopJava GC, Off-heap workshop
Java GC, Off-heap workshop
 
92 grand prix_2013
92 grand prix_201392 grand prix_2013
92 grand prix_2013
 
MySQL Performance Tuning Variables
MySQL Performance Tuning VariablesMySQL Performance Tuning Variables
MySQL Performance Tuning Variables
 
Maxscale_메뉴얼
Maxscale_메뉴얼Maxscale_메뉴얼
Maxscale_메뉴얼
 
InnoDB Performance Optimisation
InnoDB Performance OptimisationInnoDB Performance Optimisation
InnoDB Performance Optimisation
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructures
 

Destaque (6)

Performances Java et OpenDJ - LyonJUG Janv. 2012
Performances Java et OpenDJ - LyonJUG Janv. 2012Performances Java et OpenDJ - LyonJUG Janv. 2012
Performances Java et OpenDJ - LyonJUG Janv. 2012
 
BASQUETBOL
BASQUETBOLBASQUETBOL
BASQUETBOL
 
Présentation live@edu escem
Présentation live@edu escemPrésentation live@edu escem
Présentation live@edu escem
 
Mobile Datensicherheit IHK 2012
Mobile Datensicherheit IHK 2012Mobile Datensicherheit IHK 2012
Mobile Datensicherheit IHK 2012
 
Einkaufen mit dem Tablet
Einkaufen mit dem TabletEinkaufen mit dem Tablet
Einkaufen mit dem Tablet
 
SoftENGINE - eCommerce - Lösungen rund um die BüroWARE
SoftENGINE - eCommerce - Lösungen rund um die BüroWARESoftENGINE - eCommerce - Lösungen rund um die BüroWARE
SoftENGINE - eCommerce - Lösungen rund um die BüroWARE
 

Semelhante a Building a High-Performance Directory Server in Java: Lessons Learned and Tips from the OpenDS Project

SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...Amazon Web Services
 
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...Amazon Web Services
 
Deep Dive on Amazon EC2 instances
Deep Dive on Amazon EC2 instancesDeep Dive on Amazon EC2 instances
Deep Dive on Amazon EC2 instancesAmazon Web Services
 
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...Amazon Web Services
 
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»Anna Shymchenko
 
Slow things down to make them go faster [FOSDEM 2022]
Slow things down to make them go faster [FOSDEM 2022]Slow things down to make them go faster [FOSDEM 2022]
Slow things down to make them go faster [FOSDEM 2022]Jimmy Angelakos
 
MySQL Performance - Best practices
MySQL Performance - Best practices MySQL Performance - Best practices
MySQL Performance - Best practices Ted Wennmark
 
Beyond Best Practice: Grid Computing in the Modern World
Beyond Best Practice: Grid Computing in the Modern World Beyond Best Practice: Grid Computing in the Modern World
Beyond Best Practice: Grid Computing in the Modern World ThotWave
 
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling StoryPHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Storyvanphp
 
Gnocchi v3 brownbag
Gnocchi v3 brownbagGnocchi v3 brownbag
Gnocchi v3 brownbagGordon Chung
 
Seastar / ScyllaDB, or how we implemented a 10-times faster Cassandra
Seastar / ScyllaDB,  or how we implemented a 10-times faster CassandraSeastar / ScyllaDB,  or how we implemented a 10-times faster Cassandra
Seastar / ScyllaDB, or how we implemented a 10-times faster CassandraTzach Livyatan
 
Magento scalability from the trenches (Meet Magento Sweden 2016)
Magento scalability from the trenches (Meet Magento Sweden 2016)Magento scalability from the trenches (Meet Magento Sweden 2016)
Magento scalability from the trenches (Meet Magento Sweden 2016)Divante
 
Optimizing elastic search on google compute engine
Optimizing elastic search on google compute engineOptimizing elastic search on google compute engine
Optimizing elastic search on google compute engineBhuvaneshwaran R
 
Running ElasticSearch on Google Compute Engine in Production
Running ElasticSearch on Google Compute Engine in ProductionRunning ElasticSearch on Google Compute Engine in Production
Running ElasticSearch on Google Compute Engine in ProductionSearce Inc
 
Low latency in java 8 v5
Low latency in java 8 v5Low latency in java 8 v5
Low latency in java 8 v5Peter Lawrey
 
Jvm problem diagnostics
Jvm problem diagnosticsJvm problem diagnostics
Jvm problem diagnosticsDanijel Mitar
 
JITServerTalk JCON World 2023.pdf
JITServerTalk JCON World 2023.pdfJITServerTalk JCON World 2023.pdf
JITServerTalk JCON World 2023.pdfRichHagarty
 
Speed up R with parallel programming in the Cloud
Speed up R with parallel programming in the CloudSpeed up R with parallel programming in the Cloud
Speed up R with parallel programming in the CloudRevolution Analytics
 
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka Mario Ishara Fernando
 

Semelhante a Building a High-Performance Directory Server in Java: Lessons Learned and Tips from the OpenDS Project (20)

SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
 
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
 
Deep Dive on Amazon EC2 instances
Deep Dive on Amazon EC2 instancesDeep Dive on Amazon EC2 instances
Deep Dive on Amazon EC2 instances
 
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
 
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
 
Slow things down to make them go faster [FOSDEM 2022]
Slow things down to make them go faster [FOSDEM 2022]Slow things down to make them go faster [FOSDEM 2022]
Slow things down to make them go faster [FOSDEM 2022]
 
Introduction to Galera Cluster
Introduction to Galera ClusterIntroduction to Galera Cluster
Introduction to Galera Cluster
 
MySQL Performance - Best practices
MySQL Performance - Best practices MySQL Performance - Best practices
MySQL Performance - Best practices
 
Beyond Best Practice: Grid Computing in the Modern World
Beyond Best Practice: Grid Computing in the Modern World Beyond Best Practice: Grid Computing in the Modern World
Beyond Best Practice: Grid Computing in the Modern World
 
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling StoryPHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
 
Gnocchi v3 brownbag
Gnocchi v3 brownbagGnocchi v3 brownbag
Gnocchi v3 brownbag
 
Seastar / ScyllaDB, or how we implemented a 10-times faster Cassandra
Seastar / ScyllaDB,  or how we implemented a 10-times faster CassandraSeastar / ScyllaDB,  or how we implemented a 10-times faster Cassandra
Seastar / ScyllaDB, or how we implemented a 10-times faster Cassandra
 
Magento scalability from the trenches (Meet Magento Sweden 2016)
Magento scalability from the trenches (Meet Magento Sweden 2016)Magento scalability from the trenches (Meet Magento Sweden 2016)
Magento scalability from the trenches (Meet Magento Sweden 2016)
 
Optimizing elastic search on google compute engine
Optimizing elastic search on google compute engineOptimizing elastic search on google compute engine
Optimizing elastic search on google compute engine
 
Running ElasticSearch on Google Compute Engine in Production
Running ElasticSearch on Google Compute Engine in ProductionRunning ElasticSearch on Google Compute Engine in Production
Running ElasticSearch on Google Compute Engine in Production
 
Low latency in java 8 v5
Low latency in java 8 v5Low latency in java 8 v5
Low latency in java 8 v5
 
Jvm problem diagnostics
Jvm problem diagnosticsJvm problem diagnostics
Jvm problem diagnostics
 
JITServerTalk JCON World 2023.pdf
JITServerTalk JCON World 2023.pdfJITServerTalk JCON World 2023.pdf
JITServerTalk JCON World 2023.pdf
 
Speed up R with parallel programming in the Cloud
Speed up R with parallel programming in the CloudSpeed up R with parallel programming in the Cloud
Speed up R with parallel programming in the Cloud
 
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka
 

Último

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 

Último (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Building a High-Performance Directory Server in Java: Lessons Learned and Tips from the OpenDS Project

  • 1. Building a high performance directory server in Java Lessons learned and tips from the OpenDS project. Ludovic Poitou Matthew Smith Sun Microsystems #118
  • 2. AGENDA > Introduction to the OpenDS project > Architecture, Design Patterns and Tips > Experiences with Sun JVM > Conclusion 2
  • 3. AGENDA > Introduction to the OpenDS project > Architecture, Design Patterns and Tips > Experiences with Sun JVM > Conclusion 3
  • 4. The OpenDS Project > Released in Open Source in July 2006 – CDDL – Source code at https://opends.dev.java.net/ > Sponsored by Sun Microsystems > Written in Java by LDAP experts
  • 5. What is it ? > OpenDS is effectively a Java based Server supporting the LDAPv3 protocol and services – Objet Oriented, Hierarchical Data Model – CRUD operations > It comes with its own embedded database – Based on Berkeley DB Java Edition – Not accessible from outside > It has all security, access controls, password management features to safely store the information about Users
  • 6. What is it for ? > Generic object oriented data store > White pages and Email Address Book > Mostly the data store for Identities – For Authentication and Authorization – For profiles and personalization > The underlying infrastructure in all Enterprises – Leveraged by Web and Mail infrastructure products – Cornerstone of Identity Management products:  Access Management and Federation  Provisioning and De-provisioning tools
  • 7. Who for ? > Telecom service providers, financial institutions use LDAP directories for customer related services (Portal) – Storing customers identities, phones, services associated – Building highly available services for 10 Millions, up to 200 Millions users > But OpenDS can be used as OS naming service, or for SMB – OpenSolaris, Solaris, Linux... – Coupled with SAMBA, as a Domain controler – Integrated with Kerberos – White Pages... > And being 100% pure Java, OpenDS can be embedded in other Java applications or Web applications – OpenSSO 7
  • 8. OpenDS 2.2 > Released in December 2009 > LDAPv3 directory server fully standard compliant – Supports many LDAP standard and experimental extensions – Supports Multi Master Replication with 3 different levels of data consistency – Extensive security features > Improved performances, reliability over OpenDS 1.0 > Installs in 6 clicks and less than 3 minutes > Several GUI and CLI to manage, monitor the OpenDS server > Extensive documentation > Localized in 6 different languages
  • 9. Performance characteristics > As for most servers, scalability is extremely important – Up to hundreds million of entries – Up to thousands connections – Maximize use of CPUs > What is the operations throughput ? > What is the average response time ? The maximum response time ? > Our basic test – 10 M entries, with an average size of 2.6K – 2 servers, with Multi-Master replication between them
  • 10. Searchrate on Sun x4170 box
  • 11. Modrate on a Sun x4170 box
  • 12. AGENDA > Introduction to the OpenDS project > Architecture, Design Patterns and Tips > Experiences with Sun JVM > Conclusion 12
  • 13. How to reach those results ? > 2 main aspects – Architecture and code – Run-time : JVM and Garbage Collector optimization > There is a strong relationship between code design and memory optimization
  • 15. Patterns > Use of Asynchronous I/O – Exception for write disk transactions > Use of Immutable Objects – Intrinsic thread safety – Avoid need for defensive copies > Use of “Factories” over Constructors – Avoid creating an object – Ease optimization for common cases  Example : Most AttributeDescriptions have 0 options  Example : Attributes generally have 1 value – For immutable objects. 15
  • 16. Patterns > Producers / Consumers – Queues – Thread Pool – Monitors > Strategies – Queue Strategies : ConcurrentLinkedQueue vs LinkedBlockingQueue 16
  • 17. Anti-Patterns > String concatenation – Make sure to use a StringBuilder – Compiler now optimize simple “Aaa” + “Bbb” concatenation > Avoid very long methods (thousands of lines of code) > Avoid exposing the concrete representation of an object – Set vs LinkedHashSet. – Not a performance issue, but will require more work when optimizing code for performance later > Try to define only the methods you need. 17
  • 18. Java Collections > Vector and Hashtable are synchronized for all methods – Pay the price even if not necessary > Some Java collection classes are not synchronized by default – ArrayList, LinkedList replace Vector – HashSet, HashMap replace Hashtable > To synchronize, wrap in a class > With a “static factory” – Collections.synchronizedList(new ArrayList()) > ConcurrentHashMap, for concurrency – But watch when using the iterator 18
  • 19. Critical Sections > Try to minimise the code and time spent in the critical sections > But the throughput is limited by the time spent in the largest critical section – Example : LinkedBlockingQueue  200 000 operations on x64 processor  20 000 operations on the T2000 processor – We use it for the WorkQueue and Access Logs
  • 20. Caching data > Using Caches reduce the disk access thus should provide better performances > But cache eviction add pressure to the GC – When modifying entries – When the cache is too small to hold all data > A cache is also a contention point > If you want to cache objects, make sure you cache those that will be reused. > Alternate possibility, use “thread local” cache. – But watch out for the cost (with 1000 threads?)
  • 21. Server monitoring > Getting statistics for a server is mandatory > Beware of contention – Stats are updated frequently – But seldom read > A strategy could be to keep per thread statistics and collect them on demand – Not yet implemented in OpenDS !
  • 22. AGENDA > Introduction to the OpenDS project > Architecture, Design Patterns and Tips > Experiences with tuning Sun JVM > Conclusion 22
  • 23. Performance Tuning > When dealing with performances, you should consider the whole system – Java VM – OS – Hardware : CPU, Memory, Disks, Network... > In our case, we try to avoid disk I/Os – And try to cache as much of the database > We also want deterministic response times – Avoid any Full GC (Stop The World) – Make sure minor GC pauses are as small as possible 23
  • 24. JVM Tuning for OpenDS > Super Size The Heap ! – We use 32GB Heaps, sometime up to 96GB – 2GB for the New Generation (or ¼ of heap if < 8GB) – -Xms32768M -Xmx32768M -Xmn2048M > Use CMS – -XX:+UseConcMarkSweepGC – -XX:+UseParNewGC > -XX:MaxTenuringThreshold=1 – Avoid copy of objects in New Gen 24
  • 25. Some interesting JVM Options > -XX:CMSInitiatingOccupancyFraction=70 – Define the amount of occupancy in Old Gen before starting to collect – Larger = better throughput but higher full GC risk > -XX:+UseCompressedOops – For 64bits JVM, less than 32BG of heap – Will be the default in coming Java 6 updates > If running on processor with NUMA architecture – -XX:+UseNUMA > -XX:+AggressiveOpts – Enables aggressive JIT optimizations, not related to GC 25
  • 26. The Garbage First (G1) GC > Introduced in the Java HotSpot VM in JDK 7. > An experimental version of G1 has also been released since Java SE 6 Update 14. > G1 is the long-term replacement for HotSpot's low-latency Concurrent Mark- Sweep (CMS) GC > Should be officially supported with Java SE 6 Update 21 26
  • 27. G1 Characteristics > Future CMS Replacement – Server “Style” Garbage Collector – Parallel, Concurrent – Generational – Good Throughput – Compacting – Improved ease-of-use – Predictable (though not hard real-time) > The main stages consist of remembered set (RS) maintenance, concurrent marking, and evacuation pauses. 27
  • 28. JVM Options With G1 > -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC > PauseTime (Hints, Goal with no promise, otherwise use Java Real Time ) – -XX:MaxGCPauseMillis=50 (target of 50 milliseconds) – -XX:GCPauseIntervalMillis=1000 (target of 1000 msecs) > Generation Size – -XX:+G1YoungGenSize=512m (for a 512 MB young gen) > Parallelism – -XX:+G1ParallelRSetUpdatingEnabled – -XX:+G1ParallelRSetScanningEnabled 28
  • 29. OpenDS et G1 > Goal: Avoid any Full GC, best control of pauses > Collaboration between the HotSpot and the OpenDS teams – OpenDS is used as a “Large” reference application – Between 10 and 20 enhancements integrated in G1 following the tests – Performance with large heaps improved by a factor of 10 > We're still discovering it – When doing read operations, we see pauses between 10 and 20 ms with 32GB JVM – But we're still seeing Full GC when doing Write operations (More garbage, stresses more the Old Gen) – Hopefully this will be resolved in next builds 29
  • 30. OpenDS G1 and Searches 30
  • 31. AGENDA > Introduction to the OpenDS project > Architecture, Design Patterns and Tips > Experiences with Sun JVM > Conclusion 31
  • 32. Summary > OpenDS – A open source LDAP directory server, 100% pure Java – Easy to install and use – Designed for high performance and high scalability > We saw some patterns and tips used in the OpenDS project > Knowing and understanding the JVM and GC is required to build high performance server – Tuning JVM and GC is an art – Performance engineering is a profession > Who said that Java is slow ?! 32
  • 33. The Art of GC Tuning JavaOne Presentation: GC Tuning in HotSpot JVM http://developers.sun.com/learning/javaoneonline/j1sessn.jsp?sessn=TS-4887&yr=2009&track=javase 33
  • 34. Now... > Give OpenDS a try – http://www.opends.org > Join our community: – Join/Login sur Java.net – http://opends.dev.java.net – Request a Role – Subscribe to the mailing lists – IRC: #opends on freenode.net > OpenDS is localized in several languages. It's community based, through online tools. An easy way to participate. 34
  • 35. Ludovic Poitou blogs.sun.com/Ludo Sun Microsystems Ludovic.Poitou@sun.com Matthew Swift Sun Microsystems Matthew.Swift@sun.com