Expected performance -- ubuntu server, localhost

36 views
Skip to first unread message

Charles Driver

unread,
Aug 4, 2021, 10:48:17 AM8/4/21
to opencpu

Reading the various docs it seems like the performance hit from making opencpu calls should be negligible, but I am seeing a bit over 100ms for this call:

b=Sys.time()
test=system(intern = TRUE,
  paste0(
    'curl http://localhost/ocpu/library/base/R/json -d "1+1"')
)
print(Sys.time()-b)

and when I call a function I actually need (which takes approx 0.03s locally) this jumps to a bit over 200ms. Is this expected, or might there be more I can do? Required libs are loaded via .Rprofile, and I also use the functions needed once there too.

Thanks!


Charles Driver

unread,
Aug 4, 2021, 11:26:45 AM8/4/21
to opencpu
Also: When running my test script in parallel (6 sessions) I see more like .4 / .5 seconds latency.

Charles Driver

unread,
Aug 5, 2021, 5:31:09 AM8/5/21
to opencpu
Sorry, initial test code was wrong, after correction the difference between a simple function (~180ms) and the functions I'm interested in (~200ms) are as expected, but the question still stands, is 180ms expected for a simple sum, and is there any way to lower this?

b=Sys.time()
test=system(intern = TRUE,
  paste0(
    'curl http://localhost/ocpu/library/base/R/sum/ -d "a=1"')
)
print(Sys.time()-b)

Shreyas Ragavan

unread,
Nov 25, 2021, 9:37:56 PM11/25/21
to opencpu
 I would be very keen for more insight on this. I might be heading towards setting up an OpenCPU server at work to power our analytics and I am extremely keen to understand this aspect. As one might expect - I'm already fending off questions from experienced Devs at work who dismiss R as 'something used by researchers and unfit for Enterprise level performance and scale'.

Charles Driver

unread,
Nov 26, 2021, 3:09:46 AM11/26/21
to ope...@googlegroups.com
When I tested further I found RestRserve had lower latency, around 100ms. Both were reasonable to setup, opencpu a bit simpler I think, though neither was really fast enough for the case I was looking into.
--
You received this message because you are subscribed to a topic in the Google Groups "opencpu" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/opencpu/eX4vbIFgaH4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to opencpu+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/opencpu/d0367797-d93e-4d8f-aeb1-a06e2cb96859n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages