Weird performance of a rails + sinatra app
I have a rails application and a Sinatra application. The Sinatra application is written to do lookup timezone based on either ZIP or IP. Sinatra application uses geoip_city gem for lookup using IP and has its own database for ZIP lookup. The rails app talks to the Sinatra application for timezone lookup.
We worked on rails application's performance and have improved it to a good extent. We tested it using Jmeter, with 1000 threads running forever with 60 ramp-up. It performed well. We also tested the Sinatra app with similar numbers and it is performing well enough. However, when we test the piece where rails app talks to Sinatra app for the timezone lookup, after ramp up period, we get timeout errors. The timezone lookup request made by the rails app to the Sinatra app times out. If I reduce number of threads in Jmeter to 100, the application performs fine.
I wonder why this happens if rails app and Sinatra application are performing fine individually. What is it that reduces the performance when rails and Sinatra application are chained together. Is it how it is supposed to be?
As @troelskn has rightly pointed out in the comment, both the applications were competing for resources. Moving one of them to a different server with dedicated resources seems to have solved the problem.