I developped an ocpu app to run on an EC2 server but, specially when run on the EC2 server the application (even with just one user, me) is extremely slow and bumping up from a t2.micro
to a c3.large
doesn't change the slightest thing.
To see where the bottleneck is I introduced timers in my code, the results are the following:
- The R function itself lasts 846ms (400ms locally)
- The call to this function through ocpu.call() lasts 2558ms
- with the retrieval of the result, the total bumps up to 4790ms meaning the retrieval of a (big) geojson takes over 2s, while retrieving the same geojson through the API with curl gets it in 1.3s
- if I reduce the output to nothing, it still takes 1s to retrieve nothing.
On my personal computer, the total time is under 1500ms!
Conclusion: the R part itself is not much slower but everything else is!
Are they any options for opencpu so that it handles faster the data on the server?