Hi Jason,

I have a hunch that you have more Java processes running than you need 
and/or are aware of. For example, by running your Clojure app via lein run 
-m clojureweb.core/serve, you have two Java processes: one for Leiningen, 
and a separate one (started by Leiningen) for your app. It’s unlikely that 
you need Leiningen’s JVM to stick around, so you should probably try 
starting your app with the command lein *trampoline* run -m 
clojureweb.core/serve. (For details, see “Server-side Projects” in the 
Leiningen tutorial 
<https://github.com/technomancy/leiningen/blob/f9a464e008214941e93c046413004517325818bb/doc/TUTORIAL.md#server-side-projects>
.)
Also, you didn’t mention how you were starting your REPL(s), but I’m going 
to assume that you were using lein repl; if so, that’s the source of *yet 
another* Java process or two. In order to refrain from needing to keep 
other JVMs running, you might want to use Clojure 1.8’s built-in socket 
server REPL 
<http://clojure.org/reference/repl_and_main#_launching_a_socket_server>
 instead.

Cheers,
Josh

P.S. You mentioned that you’re relatively new to Clojure—welcome! =)

On Monday, March 28, 2016 at 8:11:49 AM UTC-4, Jason Basanese wrote:
>
> Hello all! I'm new to this forum. My name Is Jason Basanese and I am a 
> relatively new clojurist.
>
> I recently began hosting my first small full stack Clojure web app. While 
> doing this I ran into memory problems with my admittedly small load server. 
> The maximum it can take in temp memory is 741MB. Too much of that memory is 
> consumed giving an error when I try to run two REPLs on the server. One for 
> testing and editing code and the other for leaving the app running. My 
> other dynamic content websites which use php directly with Apache use 
> minimal memory. Why is it that running a Clojure app like such "lein run -m 
> clojureweb.core/serve" takes up so much memory? Here is the code of the 
> function I am running with that command. 
>
> (defn serve [& args]
>   (org.apache.log4j.BasicConfigurator/configure)
>   (run-server
>    (logger/wrap-with-logger
>     (reload/wrap-reload app))
>    {:port 8080}))
>
> Are the logger or the wrap-reload making it take up so much memory? Is 
> there a better way to run Clojure apps that is less robust? Or is using a 
> relatively large amount of memory just a bullet to bite when using Clojure? 
> Yes I know an obvious solution would just be to upgrade the server, but 
> where's the fun in that?
>
> Requests for more detail, comments, answers and opinions all welcome!
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to