I have built a java program within an android app that parses some data from an online website. This data is to be used from the app to show the content(organized) to the user. I tried to optimize my code as much as I could but there's not much I can do since it's a lot of data. So what I did instead was deploying the java program on HEROKU and let the server side do the work and give the result in a simple html which I can easily parse with no major delay. The thing is that this worked out pretty fine. I got a high increase in performance yet with one little problem. When I open the app for the first time in say 2 days it results to be a lot slower, but on the second run just after that it seems to be a lot faster. Now I am guessing that the HEROKU server works on some cache-like way in that the least recent run dynamic web sites get no priority until a request comes from the client side, considering that in 2,3 consequent runs I get a very high increase in performance. Now, my question is, is there a way I can sort of "give priority" to my HEROKU java program or is there another free dynamic web site that allows you to deploy a war and presents no such performance issues. To some it might seem as a no big deal. In particular I get performance increase of say from 6 seconds to 2 seconds which is actually quite a big deal since app users usually do not tolerate such kinds of delays.
Asked
Active
Viewed 50 times
-5
-
3It's more likely an issue with poor programming than with Heroku. Why don't you turn this question into an actual question instead of a wall of unrelated text? We can't just guess what your application does and magically give suggestions for that. – nbokmans Jan 16 '18 at 13:28
-
@nbokmans I'm actually getting from 6300 milliseconds to 300 milliseconds which is an increase by nearly 21 times in performance which I think is quite significant. Nearly the same thing happens if I try to run it on localhost. So I guess my code is fine. Just looking for some alternatives in that I am not way too experienced with deploying dynamic websites online. – ndricim_rr Jan 16 '18 at 13:36
-
@nbokmans and as I can see there are also other people with the same problem around here [link] (https://stackoverflow.com/questions/2606190/why-are-my-basic-heroku-apps-taking-two-seconds-to-load) just looking for a workaround to this – ndricim_rr Jan 16 '18 at 13:40
1 Answers
0
Heroku puts free apps to sleep. The first request after it sleeps will restart the app, which means you have to wait longer.
For more info see Heroku's sleeping policy for Free dynos.

codefinger
- 10,088
- 7
- 39
- 51