Arc Forumnew | comments | leaders | submitlogin
2 points by highCs 3076 days ago | link | parent

Tried using worker processes, the single arc http server still is a major contention point. As I understand now, the solution for good http server performance would be to sit a bunch of arc servers behind a reverse proxy like nginx. That explains why the arc http server isn't more complicated, it doesn't need to.


2 points by akkartik 3076 days ago | link

I'd be curious to see your experiment. How did you measure contention?

I'm not aware of any arc servers in the wild using multiple servers. This isn't for performance reasons but just correctness; we don't have a database that can keep concurrent writes from stepping on each other.

-----

2 points by highCs 3075 days ago | link

> How did you measure contention?

Very empirically. Basically, on localhost, I've a client sending a shit load of basic requests (one thread for each request) and a server printing "hello world" in the repl for each of them in a minimalistic defop. The server end up printing on the repl far after the client has ended sending requests. The absolute number of requests we are talking here is in the order of 200; server takes 5 secondes (give or take) to print the last "hello world" - on a 2.5Ghz recent CPU. I have to make more tests to see if the client may be responsible for a share of that latency. I don't see the OS and repl as bottlenecks (printed in the past in repl at tremendous rates). I may be completely wrong as I'm beginner in networking.

> I'm not aware of any arc servers in the wild using multiple servers. This isn't for performance reasons but just correctness; we don't have a database that can keep concurrent writes from stepping on each other.

I've replaced the diskvars files by sqlite entries. Sqlite is a competitor to fopen as it's advertised on the website making it a perfect choice for diskvars in my opinion (again, ultimately beginner on that matter).

-----

2 points by akkartik 3075 days ago | link

Your result does seem off. Using apachebench, I'm able to send 200 requests to a minimal arc server in 0.75s.

Here's my commandline:

  $ ab -n 200 http://localhost:8080/

-----

2 points by highCs 3074 days ago | link

Ran the same test, 200 requests for 2 seconds (my test machine is a laptop). The weird thing is that the percentiles are multiple of 16...

  Benchmarking localhost (be patient)
  Completed 100 requests
  Completed 200 requests
  Finished 200 requests

  Server Software:
  Server Hostname:        localhost
  Server Port:            80

  Document Path:          /
  Document Length:        11 bytes

  Concurrency Level:      1
  Time taken for tests:   2.456 seconds
  Complete requests:      200
  Failed requests:        0
  Total transferred:      17800 bytes
  HTML transferred:       2200 bytes
  Requests per second:    81.44 [#/sec] (mean)
  Time per request:       12.279 [ms] (mean)
  Time per request:       12.279 [ms] (mean, across all     concurrent requests)
  Transfer rate:          7.08 [Kbytes/sec] received

  Connection Times (ms)
              min  mean[+/-sd] median   max
  Connect:        0    0   1.9      0      16
  Processing:     0   12   9.1     16      31
  Waiting:        0    3   6.3      0      16
  Total:          0   12   9.3     16      31

  Percentage of the requests served within a certain time (ms)
  50%     16
  66%     16
  75%     16
  80%     16
  90%     16
  95%     31
  98%     31
  99%     31
 100%     31 (longest request)

-----

2 points by highCs 3075 days ago | link

Alright, it's off by almost 10x then my test sux. The client code must be wrong. Thinking about it quickly, it's probably not so easy to send a lot of requests in parallel... I'll use ab in the future. Thank a lot for having checked that.

-----

2 points by akkartik 3075 days ago | link

That sounds amazing! I'd never heard that about sqlite. Patches would be most welcome. If you tell me your github username I'll give you commit rights to anarki.

-----

2 points by highCs 3075 days ago | link

> That sounds amazing! I'd never heard that about sqlite.

Cool happy that sounds like interesting stuff.

> If you tell me your github username

Please find my github profile on my arc forum profile.

> I'll give you commit rights to anarki

I would be happy to contribute. Well, I have to, that's a duty; I'm given such an amazing language in the first place.

So I have these sqlite obj. I've coded worker processes which you can spawn and kill (they use the db to register, take jobs and kill themselves). You can give them any job by supplying a list. They return the result (using the db again).

I'm planning to write a cluster.arc, which manage a bunch of http servers which you can spawn and kill the same way as the worker processes (well you could do that using the worker processes themselves, I dont remember why I didnt retain that idea though, will remember...). Easy to use behind a reverse proxy, that's the goal.

I have a with-lock macro, which takes an id in argument; its like atomic but associated to an id (use the db again, so that it works inter-processes)(there is something similar in racket using files).

I have let1, alet1, when1 and aor. Not sure those macro are all relevant.

I'll be happy to contribute with the relevant part. Give me a few weeks though. Still have to tests most of these things and I'll need time to extract them from the pet-project.

-----

2 points by akkartik 3075 days ago | link

Absolutely; take your time.

-----

2 points by highCs 3071 days ago | link

Since sqlite is daemon-less, it doesnt work well when multiple processes try to access the same database; one starts receiving database locked errors. I'll see if I can find a daemon-less database engine which handles that. I want to run multiple arc http servers accessing a single database behind a load-balancer and I want a client app to have parallelism using worker processes, which would use the same kind of database engine. So I'm looking for a daemon-less database engine that multiple processes can access concurrently without me having to implement anything to support that and which works under windows, linux and OSX. Anyone knows one? I'm looking at Sophia right now [1]

[1] http://sphia.org/

-----

2 points by highCs 3068 days ago | link

Sophia doesn't allow multiple processes to access the same databse.

-----

2 points by highCs 3067 days ago | link

What I could do however, is have a master process starts an http server with a daemon-less database. At this point, one can read and write the database at any time via http requests. Then I can make the worker processes thing works. Then Arc has parallelism.

-----