我正在使用node.js將大量數據聚合到EC2 Micro實例上的Firebase中。該應用程序掃描照片的一些來源,並維護每個照片的元數據的Firebase,如URL,大小,來源,「喜歡」等。限制Firebase內存中緩存
我還保留一些聚合索引更新(按日期,由喜歡等)。實際的代碼是非常簡單的:
var db = new Firebase('https://my.firebaseio.com')
// Whenever the aggregator updates a photo, update the popularity inedx
db.child('photos').on('child_changed', function(snapshot) {
var instagram = snapshot.child('likes/instagram').val() || 0,
facebook = snapshot.child('likes/facebook').val() || 0,
likes = instagram + facebook
// Update popularity index
db.child('index/popularity').child(snapshot.name()).setWithPriority(true, likes)
})
由於我的實例(t1.micro)僅有的可用我跑出來的RAM作爲火力地堡緩存photos
收集的所有孩子RAM 615mb他們正在更新,而。
有沒有一種方法可以防止Firebase利用其內存中的緩存耗盡所有可用的RAM?