xml 文件的最大大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/132330/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
maximum size for xml files
提问by Thorsten79
whats your rule of thumb for maximum size for xml files.
什么是 xml 文件最大大小的经验法则。
What if I ask maximum no of records, and one record have 10 values for instance? Another condition is we are loading it from web.
如果我询问最大记录数,例如一条记录有 10 个值,该怎么办?另一个条件是我们从网络加载它。
回答by Galwegian
My rule is that if it's too slow to do what I want, then it's too big, and your data probably needs to be moved to some other format... database or such.
我的规则是,如果做我想做的事情太慢,那么它太大了,你的数据可能需要移动到其他格式......数据库等。
Traversing XML nodes or using XPath can be a dog.
遍历 XML 节点或使用 XPath 可能是一条狗。
回答by Thorsten79
This may be not the thing you want to hear, but... If you're thinking about the size of your XML files, chances are you should use a database instead of files (even if they are not flat files but structured like XML). Databases are highly optimized for efficient storage of huge masses of data. The best algorithms for retrieving data are in the code base of databases.
这可能不是您想听到的,但是...如果您正在考虑 XML 文件的大小,您可能应该使用数据库而不是文件(即使它们不是平面文件,而是像 XML 一样的结构) )。数据库针对海量数据的高效存储进行了高度优化。检索数据的最佳算法位于数据库的代码库中。
回答by xmjx
There isn't any. There are maximum sizes for files that depend on the file system you are using, though.
没有。但是,文件的最大大小取决于您使用的文件系统。
回答by Anjan Kant
There is no limit of XML filesizebut it takes memory (RAM)as file size of XML file, so long XML fileparsing size is performance hit.
It is advised to long XML sizeusing SAX for .NETto parse long XML documents.
有没有XML文件的限制大小,但它需要的内存(RAM)的XML文件的文件大小,所以长XML文件解析的大小是影响性能。
建议使用SAX for .NET对长 XML 大小进行解析来解析长 XML 文档。
回答by Sec
Even though not all parsers read the whole file into memory, if you really need a rule of thumb I would say not bigger than half of your available ram. Anything bigger will likely be way too slow :)
即使不是所有的解析器都将整个文件读入内存,如果你真的需要一个经验法则,我会说不超过可用内存的一半。任何更大的东西可能会太慢:)
回答by jelovirt
I don't think you should have a rule of thumb for maximum size for data, be it XML or anything else. If you need to store multiple gigabytes of data, then you store that data. What makes a difference is what API you use to process that data. However, XML may not be your best bet if your data set is very large. In those cases a relational or XML database will probably work better than a single XML file.
我认为您不应该对数据的最大大小制定经验法则,无论是 XML 还是其他任何内容。如果您需要存储数 GB 的数据,则可以存储该数据。不同之处在于您使用什么 API 来处理该数据。但是,如果您的数据集非常大,XML 可能不是您的最佳选择。在这些情况下,关系数据库或 XML 数据库可能比单个 XML 文件工作得更好。
回答by ajp
I think it depends on the context, where the file comes from/is generated from, what you are going to do with it, the bandwidth of any connection it has to pass through, system RAM size etc?
我认为这取决于上下文,文件来自/生成的位置,您打算用它做什么,它必须通过的任何连接的带宽,系统 RAM 大小等?
what is your context?
你的背景是什么?
回答by gatecrush
I worked on a project in 2010 where by i had to move a newspaper website from Typo 3 to Drupal 7 and the fastest way around at the time was to export all the content as xml and then parse them into drupal(Xpath). We tried doing it in one go but we had problems at 4Gigs .. So we divided the xmls per year and had each file have less time to parse and the file size in MBs and that went fine. Other reads suggest that the max file may depend on your ram.
我在 2010 年参与了一个项目,当时我不得不将报纸网站从 Typo 3 迁移到 Drupal 7,当时最快的方法是将所有内容导出为 xml,然后将它们解析为 drupal(Xpath)。我们尝试一次性完成,但我们在 4Gigs 上遇到了问题。所以我们每年划分 xmls,让每个文件的解析时间更少,文件大小以 MB 为单位,这一切顺利。其他读取表明最大文件可能取决于您的内存。

