Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Software Architecture in Practice Architecture and Performance Factors Introduction • In Performance Engineering it is important to understand the factors of the Architecture that determines performance of your solution. • In this presentation the most common factors are presented. • A basic understanding of queuing theory is useful for understanding the impact these factors can have on performance. Performance Factors • In the following slides we will look at some factors layer by layer. Since we cannot consider everything we will use the architecture of the TM16 application as basis – – – – – – Hardware Operating system Application Server Application Database Network Hardware • The “big four” – Processor • no. or processors, no. of cores, hyper-threading, processor speed, cache – Memory • Amount of physical memory, paging, memory speed – Disk I/O • Disk speed, RAID configuration, local disk vs. network disk – Network I/O • Network interface speed, protocol, network bandwidth • A good explanation of how to monitor these under windows can be found here: http://www.windowsitpro.com/article/monitoring-andanalysis/monitor-windows-server-with-performance-counters • Performance “hotspots” are typically detected from utilization and queue lengths – E.g. processor utilization, disk queue length etc. Operating System • Depending on the solution there is typically a number of configuration options to be made, e.g. – Size of virtual memory, network buffer sizes, number of available TCP/IP ports, etc. • Operating system services can also impact performance – Unnecessary ones should be disabled – Necessary ones should be scheduled to cause minimum impact on your application • Eg. run outside office hours or give lower priority • Virtualization – In later years virtualized servers has become more common so majority of hosted solutions are now virtualized – In general virtualization systems do not constrain performance significantly, but you should know when you run virtualized – since you might not have the capacity you think Application Server • An application server is a server that provides software applications with services such as security, data services, transaction support, load balancing, and management of large distributed systems. – The term is often used for web servers that support the Java Platform, Enterprise Edition, however its use isn't restricted to Java. • Performance tuning generally starts with the Java Virtual Machine (JVM), which serves as the foundation for the application server. • Depending on the services used by your application you will tune – – – – – – Number of Application Server instances (JVM’s) JVM heap size Thread pool size Connection pool size Caches …. Application • The application design has a major impact on the performance of your system. • In general you should focus on minimizing the work involved in moving data from database to the user – Don’t have too many layers – Client must not be too chatty with the server – Don’t fetch more data than necessary from database – and don’t visit other components when not needed • We will look more into patterns and anti-patterns in a later session Database • Most applications use a relational database for data storage. The database is a very common cause of performance issues which are typically rooted in two different aspects – The configuration/structure of the RDBMS and the database – The applications’ use of the database The query optimizer is an important piece of every DBMS. It determines how your SQL expression will fetch the data you ask for. Database optimization • Database optimization is a complex task beyond the scope of this class. Knowing about the basics is however a critical skill for performance engineers. • You always need to consider these aspects: – Keep database statistics up-to-date – Build appropriate indexes – Do the work on data as close to the data as possible • Consider stored procedures for large volumes of data – Only retrieve the data needed from the database • SELECT only the columns and rows needed • Use WHERE clauses to filter data – Use parameterized queries • SELECT x from user where name=‘?’ – Partition large databases … note • And quite a few of these rules do not apply to NoSQL databases … CS@AU Henrik Bærbak Christensen 10 Network • There is typically a number of networks involved between end users and the components of your application • For any network the two primary factors to consider are – Latency – Transmission speed • These are impacted by a number of factors, e.g. – – – – – – – – Protocol Number of “hops” from end-2-end Network utilization Network security (e.g. SSL) Amount of messages exchanged Message sizes Network packet sizes …. A few words on Java • When using the Java programming language there are a number of subjects you should be aware of – – – – – Garbage collector algorithm Heap sizes Temporary objects creations Object retention leaks …. • A good way to investigate the inner workings of your Java application – and to learn more about general JVM performance – is to use a java code profiler – JDK contains a powerful graphical profiler jvisualvm • There are a wealth of good guides on the internet describing JVM performance, e.g. – http://www.javaworld.com/javaworld/jw-08-2012/120821-jvmperformance-optimization-overview.html