Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
Chinese | ||||||
---|---|---|---|---|---|---|
|
Table of Contents style circle
...
Chinese |
---|
识别性能瓶颈 |
The saying from renowned computer scientist Donald Knuth goes:
Chinese |
---|
着名的计算机科学家唐纳德·克努特(Donald Knuth)说: |
“We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.”
Before wasting any effort on optimization, it is important to identify where the specific problems or inefficiencies are first.
Chinese |
---|
在浪费任何优化的努力之前,重要的是要确定具体的问题或低效率是第一位的。 |
Identify elements in your userview pages and menu that requires significant amounts of SQL or BeanShell scripts. These are the common causes of performance issues.
Chinese |
---|
确定需要大量SQL或BeanShell脚本的用户视图页面和菜单中的元素。这是性能问题的常见原因。 |
Use the Performance Analyzer to help identify the slow elements in your app
Chinese |
---|
使用性能分析器 来帮助识别应用程序中的慢速元素 |
Identify slow SQL queries in your app by leveraging on your database e.g. for MySQL you can use the Slow Query Log
Chinese |
---|
利用您的数据库识别您的应用程序中的慢SQL查询,例如对于MySQL,您可以使用慢查询日志 |
Check your custom plugins to ensure that they do not introduce slow processing, database queries, etc.
Chinese |
---|
检查您的自定义插件,以确保它们不会引入缓慢的处理,数据库查询等 |
Identify whether there are sufficient resources (physical memory, storage space, Java VM allocation, etc) to handle your app usage, and whether there are any resource leakages.
Chinese |
---|
确定是否有足够的资源(物理内存,存储空间,Java VM分配等)来处理您的应用程序使用情况,以及是否有任何资源泄漏。 |
Chinese |
---|
一旦确定了潜在问题的位置,就可以开始考虑优化每个区域,如下所述。 |
Chinese |
---|
确保足够的Java VM内存分配 |
The platform runs on the Java VM (JVM), and depending on the size and complexity of your apps and usage, you might need to tune the JVM heap memory size to suit your environment. If the setting is too low, the system will run out of memory resulting in OutOfMemory errors. However if the setting is too high compared the amount of physical RAM available, there might be quite a lot of swapping, in addition to overheads in garbage collection.
Chinese |
---|
该平台运行在Java VM(JVM)上,根据应用程序的大小和复杂性以及使用情况,您可能需要调整JVM堆内存大小以适合您的环境。如果设置太低,则系统将耗尽内存,导致OutOfMemory错误。但是,如果该设置与可用物理RAM的数量相比太高,则除了垃圾收集的开销之外,还可能会有相当多的交换。 |
The default JVM settings are quite low to support installation on a user’s individual computer for testing or development. To get an optimum setting might require a bit of trial and error sometimes, depending on the usage environment.
Chinese |
---|
默认的JVM设置非常低,以支持在用户的个人计算机上进行测试或开发的安装。要获得最佳设置,有时可能需要一些试用和错误,具体取决于使用环境。 |
You can use tools like VisualVM to monitor the memory usage as per Monitoring using VisualVM.
Some additional details are available at Deployment Best Practices#JavaVMConfiguration.
Chinese |
---|
您可以使用工具,如VisualVM的监视内存的使用情况按 使用VisualVM的监视。 部署最佳实践#JavaVMConfiguration提供了一些额外的细节 。 |
...
Chinese |
---|
消除资源泄漏(内存,数据库连接,文件,网络等) |
At the platform level, Joget Workflow has been optimized and tested to ensure that there are no resource leakages.
Chinese |
---|
在平台层面,Joget Workflow已经过优化和测试,以确保没有资源泄漏。 |
However, it is very possible to introduce these problems into your app. For example, you might be creating and using database connections without closing them. This would cause your database connection pool to be exhausted, and eventually cause the system to grind to a halt. When using custom Java or JDBC code in a BeanShell script or custom plugin, database connections must be closed in a try-catch finally loop e.g.
Chinese |
---|
但是,将这些问题引入您的应用程序是非常可能的。例如,您可能正在创建和使用数据库连接而不关闭它们。这将导致您的数据库连接池耗尽,并最终导致系统停止。在BeanShell脚本或自定义插件中使用自定义Java或JDBC代码时,必须在try-catch finally循环中关闭数据库连接,例如 |
Code Block |
---|
Connection con = null; try { // get connection con = datasource.getConnection(); // more processing } finally { // close connection try { if (con != null) { con.close(); } } catch (Exception e) { } } |
Likewise, any custom code that creates objects, network connections or file IO must release such resources in a try-finally block. An indication of unreleased memory would manifest itself in the Java VM memory usage, which would continually increase without reducing over time.
Chinese |
---|
同样,任何创建对象,网络连接或文件IO的自定义代码都必须在try-finally块中释放这些资源。未释放的内存指示将显示在Java VM内存使用情况中,这将随着时间的推移不断增加。 |
Using a tool like VisualVM, you will be able to monitor the memory usage.
Chinese |
---|
使用像VisualVM这样的工具,您将能够监视内存使用情况。 |
The database connection usage can be monitored in your database server, or use the v6 Database Connection Monitoring and Leak Detection feature.
Chinese |
---|
可以在数据库服务器中监视数据库连接的使用情况,也可以使用即将到来的v6 数据库连接监视和泄漏检测功能。 |
...
Chinese |
---|
优化您的应用程序和数据库查询 |
Joget Workflow has been thoroughly profiled and optimized to ensure that there is minimal overhead at the platform level. However, in enterprise apps that rely on dynamic data, each page request would require many database queries. Database calls are slow not just in query execution, but especially in network I/O. In most cases, database calls are the main performance bottlenecks that cause lengthy page response times and limit scalability.
Chinese |
---|
Joget Workflow已经过彻底的分析和优化,以确保平台级别的开销很小。但是,在依赖动态数据的企业应用程序中,每个页面请求都需要许多数据库查询。数据库调用不仅在查询执行中很慢,而且在网络I / O中尤其如此。在大多数情况下,数据库调用是造成冗长的页面响应时间和限制可伸缩性的主要性能瓶颈。 |
It is therefore significant to minimize the number of database calls that are made in the app. Check through your app to ensure that any database calls (or processing) are really necessary, if not remove them.
Chinese |
---|
因此,尽量减少在应用程序中进行的数据库调用次数。检查你的应用程序,以确保任何数据库调用(或处理)是真正必要的,如果不删除它们。 |
This also applies not just to the main userview page, but also in the userview menus. For example, displaying a count of items in the menus incur a potentially slow database query, so you need to make a decision on whether or not to display it. You can test the performance of a page with and without menus by using the Userview Embedded Mode.
In the upcoming v6, there will be a new Userview Caching feature to optionally cache userview pages and menus for a significant performance boost.
Chinese |
---|
这不仅适用于主用户视图页面,也适用于用户视图菜单。例如,在菜单中显示项目计数会导致数据库查询的速度变慢,因此您需要决定是否显示该项目。您可以使用Userview 嵌入式模式来测试带菜单和不带菜单的页面性能 。 在即将到来的v6中,将会有一个新的用户视图缓存功能来选择性地缓存用户视图页面和菜单,以显着提升性能。 |
...
Chinese |
---|
调整数据库和应用程序服务器 |
Chinese |
---|
您应该优化在您的应用程序中使用的自定义SQL查询,因为慢速查询是非常常见的瓶颈。例如,在MySQL中,您可以使用EXPLAIN 命令来帮助您确定查询的执行计划,并找到优化它们的方法。 |
For apps that require a lot of database queries, you would want to optimize both your database and database server configuration. Depending on the type of database server used, your database administrator would be best placed to perform such tuning based on your usage pattern. For example, MySQL has a section on optimization in the documentation http://dev.mysql.com/doc/refman/5.6/en/optimization.html.
Chinese |
---|
对于需要大量数据库查询的应用程序,您需要优化数据库和数据库服务器配置。根据所使用的数据库服务器的类型,您的数据库管理员将最适合根据您的使用模式执行此类调整。例如,MySQL在文档http://dev.mysql.com/doc/refman/5.6/en/optimization.html中有一个关于优化的部分。 |
There are some additional information at Deployment Best Practices#DatabaseConfiguration.
Chinese |
---|
部署最佳实践#DatabaseConfiguration有一些额外的信息 。 |
If there are a lot of concurrent requests to your app, it might also be prudent to tune your application server as per Deployment Best Practices#WebApplicationServerConfiguration.
Chinese |
---|
如果对您的应用程序有大量的并发请求,那么按照部署最佳实践#WebApplicationServerConfiguration调整应用程序服务器也是明智之举。 |
Do update your database server to the latest MySQL releases. New stable database engine releases usually have performance improvments.
Chinese |
---|
务必将数据库服务器更新为最新的MySQL版本。新的稳定数据库引擎版本通常会提高性能。 |
If you use a lot of form grids with parent and child database tables, do add indexes to your foreign key child table. This will speed up retrieval of the child form records.
Chinese |
---|
如果您对父数据库表和子数据库表使用大量表单网格,请向您的外键子表添加索引。这将加速子窗体记录的检索。 |
...
Chinese |
---|
加载测试您的应用程序和服务器大小 |
There are many factors involved in determining the server specifications needed to run Joget Workflow effectively. These are some of the non-conclusive factors:
Chinese |
---|
确定有效运行Joget Workflow所需的服务器规格涉及许多因素。这些是一些非决定性的因素: |
Total number of users
Chinese |
---|
|
Maximum expected concurrent users
Chinese |
---|
|
Number of apps running on the platform
Chinese |
---|
|
Complexity of each of the apps
Chinese |
---|
|
Amount of data generated in each app
Chinese |
---|
|
Network infrastructure
Chinese |
---|
|
For example, an environment with a small number of users running a heavily-used complex app might require more resources than an environment with large number of users running some simple apps only once a day.
Chinese |
---|
例如,运行使用频繁的复杂应用程序的用户数量较少的环境可能比运行一些简单应用程序的用户数量大的环境需要更多资源。 |
So based only on number of maximum and concurrent users, you wouldn't be able to predict what is needed. Usually installations would start with a single application server first, and scale up or cluster when necessary.
Chinese |
---|
因此,仅根据最大和并发用户的数量,您将无法预测需要什么。通常,安装将首先从单个应用程序服务器开始,然后在需要时进行扩展或集群。 |
To determine the actual requirement for your app and usage, it is best to perform load testing in your environment. There are many free and commercial load testing available, there is an article using the open source Apache JMeter tool at Joget Workflow Clustering and Performance Testing on Amazon Web Services (AWS)
Chinese |
---|
要确定您的应用和使用的实际要求,最好在您的环境中执行负载测试。有许多免费和商业的负载测试可用,有一篇文章使用开源的JMeter工具在 Joget工作流集群和亚马逊网络服务(AWS)上进行性能测试。 |
...
Chinese |
---|
介绍集群和负载平衡 |
When you have optimized your apps, you can increase your server capacity as appropriate to handle increasing load (vertical scaling). You can also start to consider performing horizontal scaling i.e. to cluster or load balance your installation. This can not only handle increased load, but also offer high availability. Read more on this at Deployment Best Practices#ClusteringandLoadBalancing.
Chinese |
---|
在优化应用程序时,可以根据需要增加服务器容量以处理增加的负载(垂直缩放)。您也可以开始考虑执行水平缩放,即对您的安装进行集群或负载平衡。这不仅可以处理增加的负载,而且还提供高可用性。在部署最佳实践#ClusteringandLoadBalancing上阅读更多 。 |