span8
第4排
功能缓存(或在FME 2017及更早版本中进行全面检查)允许您存储翻译的中间结果并检查它们。这有助于开发和调试工作区。But it consumes disk space and resources when writing the cache.确保功能缓存是远离的when running production workspaces.在FME服务器上运行工作区时,自动关闭功能缓存。
在FME 2015及以上版本中,您可以查看动态特性计数。This often gives an indication which transformers are blocking your data.You can also Run with Full Inspection which shows the feature counts and caches the data at each link on the workspace.这对调试工作区很有用,但在测试性能问题时不应使用,因为创建缓存文件会产生开销。
Before being able to tune a workspace it's vital to understand how to read an FME log file.Without this knowledge a user will often jump to incorrect conclusions about a translation,开始在错误的地方寻找性能问题。
当试图加快翻译的速度时,检查日志文件以准确地确定花费时间的位置总是有益的。
提示1:检查工具>FME选项>转换>日志时间戳信息,以确保在日志中打开时间。They are always on in the logfile saved to disc but this option displays them in the logfile window also.
在日志中要注意的第一件事是,以秒为单位报告的时间是FME处理时间——它可能与整个过程的长度不同。例如,这里所用的时间显示该过程耗时超过6分钟,但是总的现场报告FME只用了25秒。
已用时间总增量CPU(秒)
2006年7月10日14:43:06 8.5 0.0|
2006-07-10 14:43:13| 8.8| 0.3|
2006-07-10 14:46:29| 18.0| 9.1|
2006-07-10 14:49:29| 25.8| 7.9|
提示2:参见How FME logs processing timefor more information on why logged FME processing time is not the whole story,and why it matters.
因为FME的工作原理是将功能单独推过工作区(而不是组-参见FME如何处理特性以及它如何影响翻译过程 更多信息)不可能给出每个变压器的准确时间。因此,很多时间不会单独记录,而是集中在支持计时的下一个函数下。
日志文件中最重要的项目之一是临时目录。您将看到报告的情况类似于这样(为了清楚起见,删除了时间安排)…
通知FME配置:临时目录为'C:\docume~1\XXXX\locals~1\temp'
You'll also see a line commenting on the amount of disk space available in that directory...
通知系统状态:FME临时目录中可用磁盘空间为37700MB
当FME运行一个大的转换时,它通常需要大量的临时磁盘空间。这在使用多个编写器或扇出时尤其适用。因此,可用磁盘空间的数量非常重要。但在性能问题上,我们更关心所有磁盘活动的速度。
提示3: Where possible set your temporary directory to point to the fastest disk you have available.参见Setting the Temporary Directoryfor how to use FME_TEMP to set a different temporary directory
提示3a:如果可能,请使用SSD(固态驱动器)磁盘作为临时目录。These are very fast and there use will have a big impact on FME file caching performance
Tip #3b:尽可能不要将临时目录设置在操作系统使用的同一磁盘上;操作系统同时写入同一磁盘可能会减慢FME的速度。
小费3c: Where possible set the temporary directory to a disk that has a large amount of free space - it won't improve the speed but it may prevent a large translation from failing due to a lack of disk space.
提示3D: As最后一个办法是试试旧的备用磁盘——RAM驱动器(也称为RAM磁盘)!Pointing the FME temporary directory to a RAM drive,或者将源数据的副本放在RAM驱动器上,将具有与使用SSD相同的好处。
使用RAM驱动器可以将工作区完成时间(在某些情况下可缩短4小时至2小时)提高100%,even on an SSD machine.特别地,如果在翻译过程中有多次读取的文件,它确实会有所帮助。对于微站地理而言,访问文件被读取数百次。This ends up becoming a real bottleneck.因此,通过将输入文件放在RAM驱动器上,它可以有效地在转换开始之前将输入的数据缓存到RAM中。This can be useful for a wide range of formats that have high disk I/O,such as XML/GML,或基于文件的数据库(ESRI文件地理数据库)等。RAM驱动器在Windows和Linux上都可用。
The next part of the log file relates to reading data.还记得我们上面说过,FME是通过在工作区中单独推送特性来工作的吗?Well it starts processing each feature as soon as it is read from the source data.It doesn't read all features then start processing.Therefore it's similarly difficult to look at a log file and try to calculate the time spent reading the data because workspace processing time will be lumped in with it.请参阅此示例。本例中的“清空工厂管道”标记了我们完成数据读取的点。
2006-02-03 11:37:47| 342.7| 0.5|INFORM|Emptying factory pipeline
在这里,读取源数据需要342.7秒(大约6分钟)。但是,as you now know,这包括处理工作区中的功能所花费的时间。当所有的变压器都从这个工作区移除后,我们…
2006-02-03 14:44:43| 66.5| 0.3|INFORM|Emptying factory pipeline
真的!Only one minute instead of six.This tells us that 80% of the time was spent processing the data and only 20% reading it.In this case the user thought the reading was the bottleneck,but this shows it was the transformation.He should therefore check his workspace to make sure it is as efficient as possible and that there are no unnecessary transformers.
Tip #4:If you're worried about the reading performance of a workspace disconnect the readers from the transformers in Workbench and run the translation again.然后比较日志文件。这可能是因为工作空间转换器实际使用了大量的时间来读取数据,这将显示出在哪里集中您的性能工作。
数据库是许多数据集的重要组成部分,日志文件将帮助我们确定数据库性能的好坏,plus how well FME is interacting with the database.The link on tip 2 above provides a good example relating to a prefetch query carried out on an Oracle database…
2004-05-14 17:18:52 476.1 0.0通知已启动SQL缓存预取
2004-05-14 17:25:10 476.2 0.1通知已完成的SQL缓存
注意左边的实际时间差;您可以看到,从发出SQL预取到完成预取之间的时间大约是7分钟。但是,FME只记录0.1秒的CPU时间。From this we can say that the remaining time was spent by Oracle retrieving the data using the query it was given.要缩短时间,用户需要了解Oracle数据库的结构以及如何编写查询。Perhaps the field being searched on isn't indexed?也许提供的查询没有它可能的效率那么高?
小费5a: Check the log carefully to find out how much database-related time is spent outside of FME and see if you need to improve your database efficiency.说到指数(指数?)-在向表中写入数据时,表是否被索引的问题会对性能产生很大的影响。
写入未索引的表很快,因为数据库没有开销工作要做。
将数据写入索引表需要更长的时间,因为-对于提交的每一行-数据库必须立即索引数据。
As above,报告的CPU时间不会改变,因为正在进行索引工作的是数据库服务器,而不是FME。
小费5b:在可能的情况下,drop indexes before doing a bulk load into a table,then recreate them after the load is complete.它通常比在数据加载期间将索引保留在原位更快。
与此相关的是截断表和删除表之间的区别。FME有两种设置:but when you truncate a table the index remains and subsequent data loading is slower.当你先放下桌子时,a side effect is that all indexes are also dropped,因此,可以更快地写入数据,因为没有进行索引。
Tip #5c:考虑使用选项删除表,不是截断,为了从批量数据加载中获得更好的性能。在演示技巧5a的示例中,您可以看到缓存的预取。连接转换器使用缓存。接合器将记录与图形功能匹配。当FME读取匹配的数据库记录时,它将把它保存在缓存中。对于后续功能,在FME检查数据库之前,将检查此缓存是否匹配。The advantage there is that database records that are matched by multiple features do not cause FME to do a database read each time because the information is already held in memory (cached).这使得连接更快,从而减少网络流量。这是一个很好的例子…@Relate: Database query statistics for table `JOINER:MY_TABLE': 7 queries made of which 0 were sequential duplicates and 1 hit the record cache of 3 records (14% overall cache hit)
首先,这并没有明确说明匹配了多少条记录,但我们可以很好地猜测是四点。三个特征匹配记录,都有不同的身份证,and FME added these records to the cache.第四个匹配功能不必查询数据库,因为它命中了缓存中的一条记录。That's where the 14% comes in,顺便说一句。有七个查询,其中一个匹配缓存记录(1/7=14%)。因此,FME自动减少了14%的网络流量。顺序重复部分,by the way,指示有多少功能具有相同的密钥ID。例如。。。@关系:表'joiner:my_table'的数据库查询统计:7个查询,其中3个是连续重复的,2个查询命中了2个记录的记录缓存(总缓存命中率为71%),其中两个查询命中了缓存。还有三个重复的功能。重复功能不需要数据库查询,如果它们是连续的,那么2(缓存命中数)+3(重复数)=5和5/7=71%
所以缓存会影响性能,但是用户能做些什么来提供帮助呢?有两种设置可以在连接程序中应用。
第一个设置是缓存大小。通常只缓存记录的一个子集。缓存大小设置指定此子集的记录数。一旦缓存被填满,只能通过删除现有记录来添加新记录。因此,数目越大,内存中保存的记录越多,数据库读取的次数就越少。
显然,设置的大小将取决于您有多少个记录,how often they will be matched by an individual record and how much memory your system contains.At a certain point it will be more efficient to read the database regardless,if the cache is holding so many records your system runs out of memory.
Tip #5d:使用JoinerTransformers设置一个缓存大小,该大小与数据集的大小和该缓存中可能进行的数字匹配。
第二个与缓存相关的设置是预取。而不是在缓存中填充匹配的记录,发出预取查询的用户可以预加载缓存(即在进行匹配之前填充特定的数据集)。此预取查询可以选择整个表或表中最可能与功能属性匹配的选定部分。
例如,“道路”类型的许多FME特征需要数据库匹配。The database table (myrecords) has a field (record_type) with a number of values;道路,高速公路、avenues,街道。FME功能将只与记录“类型=道路”匹配,因此如果发出以下预取,整个连接过程将更加高效…
select * from myrecords where record_type = 'roads'
Tip #5e: Where Joiner transformers will match only on a known subset of records within a table it will be more efficient to prefetch that subset of records before matching takes place.
小费5F以下内容:增加事务间隔。
You can speed up translations involving all writers by lengthening the interval between committing transactions.提交事务是一项昂贵的操作,因此,建议您尽可能增大事务间隔。In speed tests performed at 亚搏在线Safe Software,将事务间隔从500更改为1000会导致特定的转换速度加快2.5%。Changing the transaction interval to 5000 resulted in the same translation running 5.5% faster.Turning transactions OFF resulted in an improvement of either 12% or 19%.更改事务间隔或关闭事务的性能优势在不同的数据集之间会有所不同。
NB:所需记录是否不在预取中并不重要-FME将直接进入数据库获取。Also,缓存大小仅在预取不完全时与预取一起使用,ie has a where statement.So 'select * from mytable' as a prefetch will cause the cache size to be ignored because the entire set of records is already being held by FME.但“select*from mytable,其中type=mytype”将使用缓存,因为预取查询尚未提取整个记录集。
您可以运行一个FME工作区的概要文件,以获得每个基础工厂或函数所花费时间的详细日志。使用工具->编辑标题添加指令:fme_profile_result_csv,即fme_profile_result_csv c:\temp\profile.csv
Note:不要忘记删除生产工作区的概要文件指令,因为概要文件对性能也有影响!
有时值得使用性能监视工具(如PerfMon)来记录进程的CPU和内存使用情况。
默认情况下,Windows将单个进程的可用内存限制为2G字节。FME是一个单线程的过程,因此是这个限制的牺牲品。When it exceeds the available memory either the system will crash or FME will need to start caching features to disk,which has a very negative effect on performance.
考虑到当前数据集的大小,2GB不是一个大数字。However,您可以通过设置操作开关将可用内存量增加到3GB。参见使用/3GB开关for how to do this.很明显,you need to have a computer with at least 3GB of RAM installed before this setting would make any difference.
您也可以使用在64位工作站上运行的32位FME它可以访问4G字节的RAM。
You might also want to consider using FME 64bit running on a 64bit processor.FME 64位上的某些支持格式有限制。Also,to realize the true benefits of 64bit applications,建议您将通常拥有的RAM数量增加一倍,即8Gbytes RAM minimum
Tip #6:使用/3GB开关增加可用内存量将使大规模翻译运行更快,允许一些以前由于内存不足而失败的翻译。
还记得我们说过,FME一次推动一个特性通过工作区吗?但情况并非总是如此。While some transformers in Workbench operate on one feature at a time (feature based) others need to work on groups of features (see关于基于组的变压器).群变压器是同时处理多个特性的变压器;例如,与许多线特征相交以生成拓扑网络。
很明显,在一组特性上工作的任何转换器必须在同一时间在内存中保存它们。
所以有一个问题是,如果在一个工作空间中有多个基于组的变压器串在一起,particularly when they are in separate streams (parallel connections),then you are potentially storing multiple copies of the data at any one time.Therefore you're using up vital system resources and potentially slowing the translation because it ends up caching data to disk instead.
小费7a: Obviously if you need a certain arrangement of transformers then you must use that arrangement,but be aware that multiple group-based transformers can eat up memory very quickly,尽可能避免这种情况。
Tip #7b: Sit back,放松点,and watch as FME handles memory in a way that will maximize performance!
提示7c:一些分组变压器有一个特性优先选项。例如,PointOnAreaOverlay has an Areas First option.FeatureMerge首先有一个供应商。快船先有快船。如果您可以适当地订购您的功能,然后使用这些选项将减少阻塞量并减少内存使用。
During the translation - as we've noted several times above - FME will either be holding your data in memory or caching it to a disk.很明显,the smaller the dataset the less memory used and the better the performance,这包括属性的数量。
一个特殊的问题是将空间数据作为属性进行携带。空间数据库格式——例如Oracle或geomedia——通常将几何图形存储在数据库中的某个字段中;例如geom。当fme读取数据时,它将geom字段转换为fme样式的几何图形,并从数据中删除该字段。
但是,通常可以将几何图形存储在多个字段中。Sometimes you wish to create a backup copy,and sometimes the original application creates copies for its own purposes.FME只将一个字段转换为几何图形,leaving any others as attributes.Very large and complex attributes,这占用了大量的系统资源。
One user we assisted had just this problem.在他的地理信息系统中有一个压缩功能,不是简单地压缩原始几何字段,创建了一个全新的字段。When FME read the data it used the compressed field for the geometry,but also read the original uncompressed data as a plain attribute.这导致了严重的经济放缓,但是,只要在翻译开始时应用一个属性移动变压器,the excess geometry column could be removed before it started to get read by group-based transformers,翻译性能大大提高。
另一种需要注意的属性是列表。一张单子可以带很多,多组属性,这是对资源的巨大消耗。例如,使用Joiner将功能连接到1000条记录,您有一个包含1000组记录的列表。这已经够糟了,但是如果您分解列表并保留所有原始属性,然后,您将获得1000个特性,每个特性都有1000组属性!
小费8:只有在转换过程中,您想要在输出上可用的任何几何图形和属性才能进行转换。删除任何多余的项目在翻译过程的早期.
尽可能让数据库完成这项工作。FME Oracle和大多数其他数据库阅读器都支持完整的SQL语句和SQL位置clauses.使用SQL联接而不是使用FeatureMerge Transformer,如果可能的话。创建一个数据库物化视图,以获得更好的性能并简化工作区(尽管有时DBA不允许这样做)。
对于ArcSDE,只有非空间表才支持SQL语句。对于空间表,请使用:表-o创建视图在联接中创建包含空间列的视图。
ArcSDE帮助提供了有关如何执行此操作的有用提示,请参见Arcgis帮助-地理数据库中视图的快速浏览:http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html/a_-quick_-tour_-views_-in_-geodatabase/002n000000t0000000/
您可以使用sdetable-o create_view和sql alter view的组合来创建复杂的表联接。
Tip #9:在某些情况下,FME可以通过将处理交给数据库来提高性能。
When you have multiple writers in a workspace the data for the first writer just gets written straightaway,而后续的编写器则将其数据缓存以备以后写入。这有助于提高性能,但也使导航页面中的第一个编写器(您可以通过右键单击>向上移动来控制其顺序)比其他任何编写器都更高效。高级工作区参数:order writers by,允许您设置将工作区中的功能写入编写器的顺序。
Note: The Order Writers By parameter is available as of FME 2016.
提示10a:当工作区中有多个写入程序时,始终确保获取大量数据的人是列表中的第一个写入者。Need an example?本常见问题解答 告诉你你需要知道的一切。
提示10b:对于峰值性能,Rastertiler或WebMaptiler输出的图块应按照这些变压器输出的顺序写入。Do not use a Dataset Fanout here as it re-orders the output and负面影响绩效.
有时,一个复杂的数学公式最容易通过将表达式分成较小的部分并在单个表达式计算器变压器中计算这些部分来计算。However,以这种方式将ExpressionEvaluator链接在一起并不是处理数据的最有效方法。
这是因为FME在TCL脚本中使用属性值,而不是从脚本中的命令读取属性值,但是,通过为每个特性重新创建脚本并嵌入相关值(请注意,这是我对无疑是更复杂问题的非常松散的解释)。
要点是,Tcl代码会针对每个ExpressionEvaluator中的每个功能重新编译,and chaining a series of these transformers together just compounds the problem.
Tip #11a:当工作区中有多个ExpressionEvaluator变压器时,考虑将它们压缩成一个单独的ExpressionEvaluator,以减少TCL调用和编译。
Another option is to replace all of the ExpressionEvaluator transformers with a single TCL script.This might sound daunting,but can be relatively simple compared to the previous idea of condensing a tricky algorithm into a single expression.
TclCaller Transformer是一种很好的方法,但是记住,性能是通过在TCL中通过FME获取属性和FME_SetAttributefunctions that are provided specifically for this purpose.
小提示# 11 b:当工作区中有多个ExpressionEvaluator变压器时,考虑用包含单个过程中所有表达式的单个TclCaller Transformer替换这些表达式。
不要咬得太多。如果你有大量的数据要处理,you may want to consider dividing your processing by some kind of grouping such as region.这样就不必一次连接整个数据集。
例如,您可以编写一个WHERE子句,一次只选择来自加拿大10个省的数据,因此,FME引擎一次只能处理大约10-20%的数据。Or you could do successive spatial extent queries.不过,this would ultimately allowing the entire country to be processed.调用工作区的脚本只需要调用10次,每次将要处理的省的名称传递给运行时参数时,运行时参数又嵌入到工作区中的SQL或WHERE子句语句中。
注意:此参数的值不应调整,除非您有特殊情况或受到安全软件的指导。亚搏在线更改此值会导致意外行为并降低性能。FME 2018及以上将不再受益于调整内存红线参数。
FME_ENGINE_MEMORY_REDLINE
资源管理器自动确定FME引擎进程应使用的最佳总内存。它还动态地将总内存分配给请求它的FME中的算法。
这个FME_ENGINE_MEMORY_REDLINE指令是对FME引擎的一个提示,提示它在消耗内存时应该具有多大的攻击性。It takes a value between 0 and 1 (0.5 is the default value).对于更积极的内存使用,应使用大于0.5的值。为了减少内存使用,应使用低于0.5的值。过于激进的风险是进程内存不足或机器不稳定。过于保守的风险是这个过程可能需要更长的时间才能完成。
:: Value = 0.5 (Default)
资源管理器将“在一个合理的地点”隐藏,with the goal of running as fast as possible without risking stability.
:: Value = 0.0
“优化内存使用”应该立即发生。这种做法将花费更长的处理时间,因为将数据写入磁盘比使用内存资源更昂贵。
:: Value = 1.0
对单个进程没有内存限制。Stashing will only occur if the entire system is dangerously low on memory.
注意:可以选择上面列出的值之间的值来进一步调整内存使用情况。
请注意,当将参数值降低到0.5以下时,必须在/tmp或fme_temp目录中存在足够的临时(物理)空间。
注:在FME 2017.1.0及更早版本中,Linux was biased towards never stashing due to performance issues.在FME 2017.1.1中,Linux行为与Windows协调。
要在FME工作台中设置此值,请使用工具-编辑标题并输入:
FME_ENGINE_MEMORY_REDLINE 0.5
as the very first line.对于FME服务器引擎,请参见How to Control FME Server Engine Memory Usage.
If you see different performance characteristics on different machines then it might be due to a virtual machine or other configuration difference.比较不同系统的程序运行时间是很难做到的。如果你看到绩效差异,这里有一些问题要问:
您可以询问日志文件。整个加工过程或某一特定区域是否出现减速?If it is in one specific area,然后您可能能够识别问题并解决它。如果在整个处理时间内,那就更难解决了。
In general,绩效基准是一个难题。许多因素需要是静态的,不能控制的因素需要最小化。使用不同的机器会破坏大多数控件。
我们经常看到性能差异的一个方面是当FME部署在Virtual Machine然后运行速度比台式机慢。This is often due to a poorly configured VM environment where several VM machines are sharing resources that are actually designed for a single use machine - such as network bandwidth,内存资源,共享驱动器。
如果您从虚拟机访问数据库,然后network latency在VM集群上可能是一个问题。再一次,主机虚拟机必须能够支持来宾虚拟机的数量,其中包括支持数据库访问和网络文件系统的网络带宽。这包括一台能够运行64位操作系统和64位应用程序的主机。我们听说禁用用于虚拟机环境的动态内存管理可以提高内存分配和性能。
?2019安全亚搏在线软件公司|法律