with cloure lein ring server, how to set max heapsize when starting the web appication?

clojure/ring
leiningen
compojure
lein new ring
clj compojure
clojure ring https
clojure ring/router
clojure web framework

So when I start the cloure web application with the command lein ring server, there are 2 processed that get started.

The first process is clojur.main that then runs the main web application. The jvm options

:jvm-opts ["-Xmx128m"  "-server"]

for ring work to control the memory for the web application. The issue is that the clojure.main -m leingen.core.main allocates 300+ MB of heap space. (see screenshot 32)

The other way is to create a uberjar:

> lein clean
> lein uberjar
Compiling demo.hello
Compiling demo.numbers
Created /home/alan/expr/demo-horizon/target/demo-horizon-0.1.0-SNAPSHOT.jar
Created /home/alan/expr/demo-horizon/target/demo-horizon-0.1.0-SNAPSHOT-standalone.jar

You normally always want to use the xxx-standalone.jar version.

Then you start the process using plain java w/o any lein at all:

java -jar /home/alan/expr/demo-horizon/target/demo-horizon-0.1.0-SNAPSHOT-standalone.jar

and you can add any flags like -Xmx4g or whatever else you like.


Update

I always run lein clean before creating a uberjar. This is the default behavior, but can be disabled by setting :auto-clean false in project.clj. According the the Sample project.clj:

  ; By default Leiningen will run a clean before creating jars to prevent
  ; undeclared AOT from leaking to downstream consumers; this disables
  ; that behaviour.
  :auto-clean false

I cannot see why starting with a dirty build would ever be a good idea, which is why I always manually run lein clean first (just in case :auto-clean has been disabled).

weavejester/lein-ring: Ring plugin for Leiningen, It provides commands to start a development web server, and to turn a Ring handler As well as the handler, you can specify several additional options via your server in your production app, then see the clojure.tools.nrepl.server project. Ring plugin for Leiningen. Contribute to weavejester/lein-ring development by creating an account on GitHub.

well never mind

apparently I should run lein trampoline ring server

This way leingen gets out of the way , saving memory

Clojure web framework Duct, In this blog post, we are going to build a server-side web application using lein repl nREPL server started on port 37347 on host 127.0.0.1 In this case, we are using a library called ataraxy to specify the routes from URL to function. [clojure .test :refer [deftest testing is]] [ring.mock.request :as mock]� edited Mar 4 '14 at 21:27 TacticalCoder 5,328 2 19 33 asked Mar 1 '14 at 13:01 enyo 90 10 I don't know much about Leiningen, so what I'll say could be all wrong or redundant, but it's been two days: lein repl starts two processes, a client and server, that talk over a tcp port. Maybe your system is configured to block the port that Leiningen

You need to set :jvm-opts in your project.clj. e.g.

:jvm-opts ["-Xmx1g" "-server"] 

See also this answer

Package a Clojure web application using Docker, In order to build this web application you need to install the following: lein repl nREPL server started on port 44721 on host 127.0.0.1 -Xmx3200m # limit the maximum heap size to prevent out of memory errors steps:� Resizing your ring is a simple process that allows you to keep your ring even if it doesn't fit. Learn how some of the best Jewelry Stores in Chicago like Christopher Duquet, resize rings for

Wednesday, Mar. 13, 2019, with cloure lein ring server, how to set max heapsize when starting the I start the cloure web application with the command lein ring server,� Out of the box, set up your Ring device in the Ring app and immediately see, hear and speak to whoever’s in front of your device, from anywhere. To record the moments caught on camera, plus go back and review, download or share your Ring video, subscribe to Ring Protect.

Execute commands after REPL initialization in Travis CI, with cloure lein ring server, how to set max heapsize when starting the web appication? So when I start the cloure web application with the command lein ring� • The Admin can set the retention policy to any number of days, although there are preset options for 30, 60 and 90 days. Once a policy is set, on a nightly basis all content older than the specified number of days will be deleted. • Invite emails and password reset emails are enabled.

Newest 'leiningen' Questions - Page 2, with cloure lein ring server, how to set max heapsize when starting the web appication? How to make the Chestnut Application Template for Clojure work? In order to write a web app in clojure, it's necessary to understand the library Ring.Ring is a lovely clean design, with good up-to-date docs in the form of its wiki on github.

Comments
  • lein-ring suggests that you use lein ring uberjar rather than just lein uberjar. It does mostly the same thing but sets :auto-clean false, whatever that means.
  • Don't you mean project.clj? I think he already tried that as described in the post.