EC2 bitnami rubystack extremely slow - amazon-ec2

I am running a single rails application on bitnami RubyStack 3.2.7-0 (rails 3.2, ruby 1.9.3) on a micro instance.
The application is pretty simple, users can log in, upload some files, change their account settings, and that is pretty much it.
my concern is that simplest operations are taking extremely long to respond e.g. log-in takes about two minutes to respond (and all it has to do is fetch corresponding user from db and verify the password).
use-cases which involve sending emails (e.g. forgot password) take even longer but I guess that is because it takes some time to connect to gmail's smtp server (that's what I am using to send emails).
any ideas why it's so slow? should I upgrade instance's size?

Try to use 1.9.3 with patches from falcon:
1. for speed up load time
2. for decrease memory for hash
(both summarized here https://gist.github.com/1688857?utm_source=rubyweekly&utm_medium=email)
3. backport garbage collector from ruby 2.0 https://gist.github.com/1687289

Related

Heroku or Amazon to host a backend Rails JSON API? Which should I use?

The answer to this no doubt lies in answering exactly what I need. The thing is... I don't really know.
The criteria for my choice will be price. Whatever is cheapest, unless both are so closely similar and the every so slightly more expensive one is a much better service.
I'm creating an iOS application, and have a Rails backend JSON API that serves my app.
I have a Post/Comment style app. I don't store any images, just text throughout various tables, etc. I shouldn't need much data with no images, and the fact that I will be purging old data (old posts / comments that are no longer relevant are just deleted).
I need a scheduler, likely daily, but guaranteed no more frequent (hourly etc not needed). So I need to run cron tasks daily.
My application does have a user sign-in. Sign-up and you can post and comment, otherwise you can only view. Does that mean I'm going to need an SSL endpoint, or is that not necessary?
Other than that I'm just serving GETting/POSTing data. I don't need anything else that I can think of. As a beginner, am I possibly overlooking anything?
Which service should I go with given the above. This is my first iOS app, and Rails backend (first time working with either), and first time deploying anything to either service, so I'm looking for some advice in this area.
Thanks!
Short googling gave me these:
HEROKU VS. AMAZON WEB SERVICES
Ruby hosting in the cloud – Elastic Beanstalk vs Heroku vs EngineYard

Linode backup for Heroku

How would I go about setting up a backup for heroku downtimes set up on a vps like linode? (using nginx/unicorn)
Essentially very simply, but also with a whole world of hurt.
Simply create an instance of your application of said VPS.
Then you need to ensure that you're able to flip your DNS from Heroku to said VPS without waiting for a TTL to expire, or someway of letting the world know your application has moved.
Then figure out a reliable way of ensuring that the code on both environments is exactly the same, and works on both different server setups
Then figure out how you can keep the data up to date in both environments so that when you do need to flip, the data will be the same in both environments.
Then you need to figure out a way to remind yourself to keep this secondary VPS up to date from a server management point of view. Software updates, security patches etc etc.
Then you need to figure out a way that you can notified when Heroku is down 24/7
Then you need to hope that when Heroku is down that Linode isn't
... or just accept that any host will go down, and it can cost a hell of a lot of money to ensure that your site doesn't. To be honest, it's probably better for you to look at some sort of hosting setup that allows redundancy and failover across several locations (which won't be cheap)
There are third party services which provide the ability to keep your site (parts of) up if your server goes down - At least it appears to the user that your site is up but it's not working properly behind the scenes. CloudFlare is one such service. It sits in front of your site/application and performs magic (quite simply). It works with static/dynamic sites - and if your server goes offline then they are able to serve static parts of your site. See http://support.cloudflare.com/kb/what-do-the-various-cloudflare-settings-do/what-does-enabling-cloudflare-offline-browsing-do

Sinatra + Heroku: Store data >4k in a Session

I have a Sinatra app that will be running on Heroku.
It has a fairly long running method (approx 1 to 3 seconds) that creates a list of data. I've been storing this data in a session. So that when my user needs to access it again I avoid having to regenerate the list (they use it often).
In some instances the data is over 4k. Meaning that I can no longer store it in a session.
Rack::Session::Pool, works perfectly. Except that it is not compatible with heroku (since dynos do not share memory).
Could someone suggest how I might best store this data?
I've considered writing it to my SQL database, since a SELECT would be less expensive than the original generation of the list. There must be a better way?
If you don't want to use a DB then how about something like Memcache - Heroku have a memcache addon that you could use.

Free Ruby scheduled tasks (off the rails) hosting?

I have some simple Ruby scripts to run as a background job. They are in an infinite while loop to monitor external database changes. Can someone recommend a hosting provider that can do it for free to start?
I looked at AWS and the EC2 micro instance is actually a good fit for the first year. Anything equivalent beyond the first year?
Then I looked at Heroku. It seems a hack and overkill to use Delayed Job in the Rails framework.
Google App Engine is also a good fit as long as I am willing to rewrite my Ruby scripts to Python.
More background on my project. I am using CouchDB + CouchApp. It requires some external scripts to monitor new users sign up and send out forget password emails.
I don't know about free, but there is SimpleWorker, which lets you offload processes (and apparently schedule them too!) to their cloud infrastructure.
Try using http://callmyapp.com
Are you able to set up an always on machine at your house? It's probably going to be just as reliable as hosting it with a free tier provider.

Setting up Mongo DB and hosting

Recently I stumbled across mongoDB, couchDB etc.
I am hoping to have a play with this type of database and was wondering how much access to the hosting server one needs to get it running.
If anyone has any knowledge of this, I would love to know whether it can be set up to work when your app is hosted via a 'normal' hosting company.
I use Mongo, and so I'm really only speaking for Mongo, but your typical web hosting environment wouldn't allow you to set up your own database. You'd want root-level (admin) access to the server to set up Mongo. To get that, you'd want something like a VPS or a dedicated server.
However, to just play around with Mongo, I'd recommend downloading the binary for your OS and giving it a run. Their JavaScript shell interface is very easy to use.
Hope that helps!
Tim
Various ways:-
1) There are many free mongodb hosting available. Try DotCloud.com. Many others here http://www.cloudhostingguru.com/mongoDB-server-hosting.php
2) If you are asking specifically about shared hosting, the answer is mostly no. But, if you could run mongoDB somewhere else (like from the above link) and want to connect from your website, it is probably possible if your host allows your own extensions (for php)
3) VPS
How about virtual private server hosting? The host gives you what looks like an entire machine... hard drive, CPU, memory. You get to install whatever you want, since it's your (virtual) machine.
In terms of MongoDB like others have said, you need the ability to install the MongoDB software and run it (normally as a daemon). However, hosted services are just beginning to appear, such as MongoHQ. Perhaps something like this might be appropriate once its out of beta (or if you request an invite).
It appears hosted CouchDB services are also popping up, such as couch.io or Cloudant. I personally have no experience with Couch so I can be less certain than with Mongo, but I'd imagine that again to run it yourself, you'd need to install the software (and thus require root access).
If you don't currently have a VPS or dedicated server (or the cloud-based versions of the aforementioned), perhaps moving your data out to a dedicated hosted service would be an ideal way to go to avoid the pain and expense of changing your hosting setup.
You can host your application and your database in the different hosting servers.
For MongoDB you can use mongohq or mongolab with space 0.5 Gb for free

Resources