Skip to content

Feature/internal api url#691

Merged
rubenarslan merged 3 commits into
rubenarslan:masterfrom
timseidel:feature/internal-api-url
Jun 11, 2026
Merged

Feature/internal api url#691
rubenarslan merged 3 commits into
rubenarslan:masterfrom
timseidel:feature/internal-api-url

Conversation

@timseidel

@timseidel timseidel commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Free Speed improvement by skipping DNS, TLS and Proxy when using the formr API in openCPU. Fallback is current behaviour.

Quick Benchmark for a api call (ca 30% faster):

Code:

formr_api_authenticate()

n <- 100
elapsed <- numeric(n)
for (i in seq_len(n)) {
  t0 <- Sys.time()
  s <- formr_api_sessions(.formr$run_name, limit = 1)
  elapsed[i] <- as.numeric(difftime(Sys.time(), t0, units = "secs"))
}

cat(sprintf("Host: %s\n", .formr$host))
cat(sprintf("formr_api_sessions (n=%d):\n", n))
cat(sprintf("  avg: %.1f ms\n", mean(elapsed)*1000))
cat(sprintf("  min: %.1f ms\n", min(elapsed)*1000))
cat(sprintf("  max: %.1f ms\n", max(elapsed)*1000))
cat(sprintf("  p50: %.1f ms\n", median(elapsed)*1000))

Host: https://formr.rstudy.org/api
formr_api_sessions (n=100):
avg: 63.9 ms
min: 43.1 ms
max: 176.1 ms
p50: 58.9 ms

Host: http://formr_app/api
formr_api_sessions (n=100):
avg: 43.8 ms
min: 25.2 ms
max: 163.2 ms
p50: 38.5 ms

timseidel and others added 3 commits June 10, 2026 01:08
…plaintext caveats, changelog entry

- Functions.php: hoist the host choice into $api_host with an explicit
  '' default for Config::get, instead of nesting rtrim/?:/addcslashes
  in one line.
- config-dist: document that the internal hostname must reach an
  API-serving vhost (don't rely on first-vhost fall-through) and that
  the bearer token is plaintext HTTP on this URL.
- CHANGELOG: Unreleased/Added entry.
@rubenarslan rubenarslan merged commit c96e9dc into rubenarslan:master Jun 11, 2026
1 check passed
@timseidel timseidel deleted the feature/internal-api-url branch June 27, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants