载波或蜻蜓 [英] Carrierwave or Dragonfly

查看:155
本文介绍了载波或蜻蜓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究rails文件上传工具,而那些对我来说最吸引人和最有趣的是carrierwave和蜻蜓。

从四处看,似乎carrierwave采取了更传统的风格,您可以在保存文件上处理,而蜻蜓是中间件,所以它可以让你在飞行过程中。



我想知道是否有人参考性能测试或任何比较两者的测试。

另外,只要好奇人们对两者的看法,他们更喜欢什么,当然他们为什么喜欢它。

解决方案

取决于设置。正如Senthil写道,只要你有一个缓存代理在前面,使用Dragonfly就可以了。



但是如果你使用的是内置的rails缓存,Carrierwave将会性能更好,因为这些文件可以被加载而不需要任何处理。如果你没有做任何处理,这没有关系。



下面是我在考虑Mongomapper项目的图像时总结的: b
$ b

Carrierwave:


  • 优点

    • 生成($)
    • 可以直接从静态/缓存文档使用文件

    • 不需要任何cache-front
    • li>
    • 支持各种存储后端(S3,Cloudfiles,GridFS,普通文件),如果需要,可以方便地扩展到新的存储类型。 b $ b

      • 生成大拇指上传(diffucult生成新的大小)
      • 本地不支持mongomapper

      • 为每个生成的文件/缩略图使用存储空间。如果您使用普通文件存储,则可能会耗尽inodes!




    蜻蜓:
    $ b




      • 应该使用mongomapper,因为它只是扩展了ActiveModel li>
      • 动态生成缩略图(更容易创建新的布局/缩略图)
      • 只存储一个文件!节省空间:)


      • 缺点

        • 没有缓存代理,rack :: cache或类似的文件。
        • 没有办法像需要的那样访问文件。

      • li>


      我最后使用了两种方法。



      未来的愿望是carrierwave再次支持MongoMapper。在各种情况下使用后,我发现MongoMapper(rails3分支)中的功能总能正常工作,而且易于使用插件进行扩展。不能说现在的Mongoid一样,但可能会改变。


      I have been looking into rails file upload tools and the ones that seemed the most appealing and interesting to me were carrierwave and dragonfly.

      From looking around it seems like carrierwave takes the more traditional style where you can process the file on save whereas dragonfly is middleware so it allows you to process on the fly.

      I was wondering if people had any references to performance test or any test that compare the two.

      Also, just curious on what people's opinions are about both and which they prefer and of course why they prefer it.

      解决方案

      Depending on the setup. As Senthil writes, as long as you have a cache-proxy in front, it's fine with Dragonfly.

      But if you are using the built-in rails caching, Carrierwave will perform better, as the files can be loaded without any processing. If you don't do any processing, it doesn't matter.

      Here's how I summarized when considering both for Images on a project with Mongomapper:

      Carrierwave:

      • Pros
        • Generates thumbs on upload (saves CPU time)
        • Can use files directly from a static/cached document
        • Doesn't need any cache-front
        • Supports various storage backends (S3, Cloudfiles, GridFS, normal files) easy to extend to new storage types if needed.
      • Cons
        • Generates thumbs on upload (diffucult to generate new thumbsizes)
        • Doesn't natively support mongomapper
        • Uses storagespace for every file/thumb generated. If you use normal file storage, you might run out of inodes!

      Dragonfly:

      • Pros
        • Should work with mongomapper, as it only extends ActiveModel
        • Generates thumbs on the fly (easier to create new layouts/thumbsizes)
        • Only one file stored! Saves space :)
      • Cons
        • Eats CPU on every request if you don't have a cache-proxy, rack::cache or similar.
        • No way to access thumbs as files if needed.

      I ended up using both in the end.

      A future wish is for carrierwave to suppert MongoMapper again. After using both in various situations, I've found that the features in MongoMapper (rails3 branch) always works, and are easy to extend using plugins. Cannot say the same for Mongoid as of now, but that might change.

      这篇关于载波或蜻蜓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆