2012-08-22 38 views
1

我有一個Rails 3的應用程序,需要生成的圖像,並且將數據發送給瀏覽器。如何解決內存泄漏與在Heroku由send_file(或SEND_DATA)?

的應用程序必須部署在Heroku上。

然而,Heroku只支持通過內存中保存的Mongrel流。這進而導致Heroku的要慢,然後殺死十幾請求後,該線程。

https://devcenter.heroku.com/articles/error-codes#r14-memory-quota-exceeded

我目前使用SEND_DATA或由send_file從ActionController的:: DataStreaming

http://api.rubyonrails.org/classes/ActionController/DataStreaming.html#method-i-send_data

Heroku的不支持機架:: SENDFILE或x-sendfile的。

https://devcenter.heroku.com/articles/rack-sendfile

項目「紅寶石雜種-X-的sendfile」說:「通過雜種流非常多的數據是一件壞事;彈弦內存泄漏」,並提供了一個「內雜種的解決方案」。但它看起來不是一個好的解決方案。

http://code.google.com/p/ruby-mongrel-x-sendfile/

緩慢解決方案是向第一上載的每一個文件,以亞馬遜S3。

有沒有人有任何想法嗎?

回答