I'm using OpenHosting, and now running an instance of this Arc News software, along with several small Apache-based sites.
OpenHosting was the best VPS I could find when I signed up for it, but there appear to be better deals available now. If I were doing it again (or bothered to move) I'd probably go with Slicehost.
Okay, forgive me if I'm retarded, but it's been a while since I've done any lisp and reading someone's source always takes a while.
I was trying to go through news.arc and figure out how it deals with memory, and as best I can tell, it doesn't seem to. It looks like it just loads some n most recent stories/posts on startup, and accumulates new ones in memory while simultaneously saving them.
This seems to me that if left running, the app will eventually suck up memory and need to be restarted. Is this the case, or did I miss the line in the implementation where it flushes old stories out?
I'm not convinced of that. It appears to be a macro for building a cache of various things with a timeout. It doesn't appear to touch the stories* table.
On an unrelated note, can anyone explain to me the memory model/threading mechanism interaction? It seemed at first that it was a single-threaded server, but after looking at srv.arc, it's clear that multiple threads are being spawned for the server process, yet stories, profs, and votes* aren't don't seem to be rebuilt from permanent storage, which implies the tables can be shared between processes. Which, I guess, goes back to my original question. So this isn't unrelated at all.
Hmm. After another cursory glance, yes, this appears about correct.
As for memory model: global variables are always shared between threads. The underlying implementation automatically locks tables when mutating them AFAIK.
As for suck up memory: I suppose the thinking is that a single post may very well take less than half a kilobyte, and modern computers have gigabytes of memory, so...
That was my thought too. I suppose I may have been overestimating the traffic to HN, or the size of the server or both. I guess I wanted a definitive answer about having to restart the server periodically. That seems to be the case, but it doesn't seem to be too bad.
This seems to be a pretty good model for a moderate-traffic app with data that gets modified infrequently. I don't think I'm quite ready to arc just for that, but I was wondering if this is a sensible approach in any other language, say, python? Any thoughts?
Well, Arc is still starting. In more-established languages, such approaches are unnecessary: there are libraries which will handle caching of data etc. properly, releasing unused memory for garbage collection once they are no longer accessed for some time, and rebuilding objects from permanent store if they have been disposed. In Arc it's still not yet implemented, so that approach works fine.
That said you might be interested in the so-called "Anarki" repository, which contains some of the elements I and others have built so that the server works a little better. For example: being able to serve files in subdirectories of your Arc installation, instead of the Arc installation; table-like data structures for caching data, or for persistent disk-based data; a slightly more extensible language, with some of the more common methods of extension already prepackaged in macros; etc.
Can you give an example of such libraries, off the top of your head?
I am basically interested in small multi-user applications that don't sit on top of relational databases. There really isn't too much information out there on the matter. Everyone seem to want to use a database, even for the simplest things. I suppose that given the pedigree of arc, this flat file storage business seems sensible enough.
Anyway, thanks for the pointer to anarki. I'll take a look at it.
For that matter, most languages prefer db's because of the fact that file storage operations don't have, umm, structure.
In fact the canonical Arc web app, news.arc, has a list structure to store in the "flat" file. Thus for simple apps where entities only have a few not very complex fields, textual representations of lists seem to be enough.
In other languages however their "array" syntax (which is approximately what lists are in Arc) is usually not readable by a built-in function a la lisp 'read. Also, their array syntax is usually not the center of attention, unlike in Lisp where the code syntax is itself the "array" syntax.
Sorry to dredge up an old post, but I was wondering pretty much the same thing. Is it possible to use arc on a shared host? Has anyone here done so? Python is already supported by many such hosts, and it doesn't seem like it should be too hard to do the same with arc.
All of the previous comments presumed virtual private servers, as far as I could tell. I am basically wondering if arc (or another lisp) could be run on a host such as DreamHost via fastcgi, or a similar method. Since python and ruby are run on DreamHost this way, it seems feasible, and I was wondering if anyone else had done this with arc or another lisp.
Poking around the DreamHost support wiki and terms of service, I can't see anything stopping you. You can run an Arc interpreter in the background, so long as it doesn't eat too many resources, and I can't see anything stopping you from forwarding requests to it.
However, it will not be officially supported in the same way that Ruby and Python are, so you'll be on your own when it comes to fixing problems. It might be better to use their private hosting service so that they don't complain about your Arc process (which they may do if a bug causes it to behave badly). Although this means it runs on a private virtual server, you still get all the same support and software as with the shared service.
Another option is if your provider will forward web requests that come in on the standard HTTP port 80 for your domain to your Arc process listening on a port such as 8080.
I would assume so. I've used Apache's ProxyPass frequently and haven't had a problem. There's no technical reason that I know of that it would be either faster or slower than fastcgi. In both cases Apache is passing on the request to a persistent process. I haven't measured it though.
You'd need to find a provider who allowed you to install executables, so that you could install MzScheme. Then, I haven't heard that anyone has implemented the fastcgi protocol for Arc, so you'd need to implement that.
I haven't tried it, so I don't know, but in general I've found it easy to call MzScheme code from inside of Arc.
You can add xdef's to ac.scm; Anarki has a $ macro to call into MzScheme if you use Anarki; and I describe my favorite way to call into MzScheme here: http://arclanguage.org/item?id=8719
I see that minivds.com have low prices (starting at $5,95 / month) for FreeBSD-based VDS. Also they offer ~1 GB of preinstalled software that doesn't count towards your quota.
The information is from their site, not my personal experience. Actually I was going to use it myself, but haven't yet. What do you think of it ?
Is there a standard graceful way of stopping a background process?
I could: launch nsv as a thread in the background, then fg it back, then use (quit) in the repl. But is there a better way to do this? Does (quit) shut down the server gracefully?
upon further reading through the forum, i figured out that the timeouts were a side-effect of the 'date problem' but because i hadn't been quick on the uptake, i had no idea that was what i was even looking for.
moving to anarki/arc-wiki stable fixed that. thanks for putting up with me, everyone!! :)
you are my hero, i hadn't seen the thread procedure documented in the tutorial.
the problem manifests itself as either 502 errors (served via mod_proxy_balancer) or "server dropped the connection" errors, but the thread business helps immensely.