In general, running any kind of JVM via Leiningen, using the 'ps' command
with lots of 'wwww' on the end of the command line options should give full
command line options used to start the JVM, so you can see what is
happening.

Understanding exactly which options are good or bad for performance, I
don't have anything to add to the message I am replying to.

Andy

On Thu, May 14, 2015 at 2:42 PM, Alex Miller <a...@puredanger.com> wrote:

> By default, I believe that lein will set:  -XX:+TieredCompilation
> -XX:TieredStopAtLevel=1 for the JVM opts.
>
> If you supply :jvm-opts, they will be *added* to these. Using ^:replace
> will instead *replace* the defaults with what you supply. There are a bunch
> of rules in the JVM for whether -server is used by default but they have
> are different across versions so I just use -server so I don't have to
> wonder. I often also set a max memory with -Xmx512m so that's known too.
>
> Using -XX:+AggressiveOpts will enable optimizations that are available but
> not the default (yet) in your current JDK. Sometimes that's helpful but
> what that actually does will depend on your version.
>
> That's a good place to start. There are lots of other things that *might*
> help (like GC settings), but you should probably understand what it all
> means before applying it, esp GC settings.
>
>
>
> On Thursday, May 14, 2015 at 4:29:50 PM UTC-5, Lee wrote:
>>
>> FWIW if I run with no :jvm-opts at all then I often crash with an
>> out-of-memory error, so I do know that whatever happens by default doesn't
>> do what I'm doing with respect to memory, at least.
>>
>> I don't know what happens with respect to the other issues (tiered
>> compilation and whatever else) by default, or with -server, etc.
>>
>>  -Lee
>>
>>
>> On May 14, 2015, at 4:59 PM, Colin Yates <colin...@gmail.com> wrote:
>>
>> Now I feel even more of an ignoramus :)
>> On 14 May 2015 21:57, "Mark Engelberg" <mark.en...@gmail.com> wrote:
>>
>>> I know that remembering to put "-server" used to be a huge issue, but I
>>> thought that on all recent versions of Java on all modern 64-bit machines,
>>> -server is now the default.  I thought it was a non-issue at this point.
>>> Is that incorrect?
>>>
>>> On Thu, May 14, 2015 at 1:54 PM, Colin Yates <colin...@gmail.com> wrote:
>>>
>>>> Probably not helpful, but I tend to rely on the jvm optimisations and
>>>> just -server. I figured this is an area where a little knowledge is a
>>>> dangerous thing.
>>>>
>>>> At the very least I would have a realistic benchmark suite to prove to
>>>> myself that these gains were worth it. In my experience the performance
>>>> bottleneck is always in design.
>>>>
>>>> Just my 2p, although with my self-confessed ignoramus status it is more
>>>> like 0.5p :).
>>>> On 14 May 2015 21:46, "Lee Spector" <lspe...@hampshire.edu> wrote:
>>>>
>>>>> I'd like to get more guidance on how to specify :jvm-opts for maximum
>>>>> performance. I've received some help on this topic from people on this 
>>>>> list
>>>>> in the past (thanks!), but I'm pretty sure that I'm still not doing things
>>>>> right.
>>>>>
>>>>> I'm almost always interested in maximum performance for long-running,
>>>>> compute-intensive and memory-intensive processes, almost never caring much
>>>>> at all about startup time or anything else.
>>>>>
>>>>> I also run my code on different machines, with different numbers of
>>>>> cores and amounts of memory, and would prefer to be able to put something
>>>>> in my project.clj that will do something reasonable regardless of what
>>>>> machine it's running on.
>>>>>
>>>>> I run my code with "lein run", and I'd like whatever I need to "run
>>>>> fast" to be in project.clj.
>>>>>
>>>>> I don't know a lot about JVM options, and I've tried to figure out
>>>>> what to specify for :jvm-opts by asking questions here and web searches,
>>>>> but I'm not at all confident that I'm doing it right yet. And because my
>>>>> systems are also stochastic, it's not easy for me to do timing tests on 
>>>>> the
>>>>> options I've tried.
>>>>>
>>>>> I think there are options relevant to memory and also garbage
>>>>> collection and maybe also compilation... and what else? I wish there was a
>>>>> simple switch to get maximum performance of the sort I've outlined here 
>>>>> (or
>>>>> at least a reasonable stab at it), but I gather that there isn't.
>>>>>
>>>>> Anyway, here's what I've been using recently, which just deals with
>>>>> memory and GC (and maybe not in the best way):
>>>>>
>>>>>   :jvm-opts ~(let [mem-to-use (long (* (.getTotalPhysicalMemorySize
>>>>>
>>>>>  (java.lang.management.ManagementFactory/getOperatingSystemMXBean))
>>>>>                                        0.8))]
>>>>>                [(str "-Xmx" mem-to-use)
>>>>>                 (str "-Xms" mem-to-use)
>>>>>                 "-XX:+UseG1GC"])
>>>>>
>>>>> After seeing Alex's post I thought that maybe I should add "-server",
>>>>> as follows:
>>>>>
>>>>>   :jvm-opts ~(let [mem-to-use (long (* (.getTotalPhysicalMemorySize
>>>>>
>>>>>  (java.lang.management.ManagementFactory/getOperatingSystemMXBean))
>>>>>                                        0.8))]
>>>>>                [(str "-Xmx" mem-to-use)
>>>>>                 (str "-Xms" mem-to-use)
>>>>>                 "-XX:+UseG1GC"
>>>>>                 "-server"])
>>>>>
>>>>> Is that right? Does it make sense? What does "-server" do? Also,
>>>>> should I also be using "^:replace"?
>>>>>
>>>>> I've looked in
>>>>> https://github.com/technomancy/leiningen/blob/master/sample.project.clj
>>>>> in hopes that this would say more about this stuff, but it doesn't say
>>>>> anything about -server or ^:replace.
>>>>>
>>>>> Looking into the compilation options, it looks from
>>>>> https://github.com/technomancy/leiningen/wiki/Faster that I should be
>>>>> specifying:
>>>>>
>>>>> :jvm-opts ^:replace []
>>>>>
>>>>> This is also familiar to me from some earlier discussions. But how
>>>>> would I combine this with the memory/GC/server(?) options above?
>>>>>
>>>>> A guess would be that maybe I should do this:
>>>>>
>>>>>   :jvm-opts ^:replace
>>>>>               ~(let [mem-to-use (long (* (.getTotalPhysicalMemorySize
>>>>>
>>>>>  (java.lang.management.ManagementFactory/getOperatingSystemMXBean))
>>>>>                                        0.8))]
>>>>>                [(str "-Xmx" mem-to-use)
>>>>>                 (str "-Xms" mem-to-use)
>>>>>                 "-XX:+UseG1GC"
>>>>>                 "-server"
>>>>>                 "-XX:-TieredCompilation"])
>>>>>
>>>>> Note that this guess involves changing a + to a - in the last line,
>>>>> which was suggested for the opposite purpose at
>>>>> https://github.com/technomancy/leiningen/wiki/Faster -- but I don't
>>>>> know if it's legitimate.
>>>>>
>>>>> Is this a reasonable thing to do to get maximum performance for
>>>>> long-running, compute-intensive and memory-intensive processes?
>>>>>
>>>>> Is the tiered compilation thing maybe already done by including
>>>>> "-server"?
>>>>>
>>>>> I'm probably at least somewhat confused about several different issues
>>>>> here...
>>>>>
>>>>> Any help or pointers would be appreciated.
>>>>>
>>>>> Thanks,
>>>>>
>>>>>  -Lee
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> > On May 14, 2015, at 3:47 PM, Alex Miller <al...@puredanger.com>
>>>>> wrote:
>>>>> >
>>>>> > Gah. Meant in project.clj:
>>>>> >
>>>>> > :jvm-opts ^:replace ["-server"]  ;; maybe also set max heap with
>>>>> "-Xmx1g" in there
>>>>> >
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Clojure" group.
>>>>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Clojure" group.
>>>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> Lee Spector, Professor of Computer Science
>> Director, Institute for Computational Intelligence
>> Cognitive Science, Hampshire College
>> 893 West Street, Amherst, MA 01002-3359
>> lspe...@hampshire.edu, http://hampshire.edu/lspector/
>> Phone: 413-559-5352, Fax: 413-559-5438
>>
>>  --
> 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.
>

-- 
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