colvinco commented on PR #1320:
URL: https://github.com/apache/solr/pull/1320#issuecomment-1411718416

   > A simplifying alternative would be to check gradle.properties into the 
project (but still marked ignored in .gitignore) and with Gradle's own defaults 
for number of workers & tests, or choose low ones. Advise users to edit them 
according to their machine. We are overthinking this stuff today! This has dev 
maintenance costs we pay right now. Generating this file is over-engineered IMO.
   
   I would create a `gradle.properties.template` file that lives in source 
control and copy it to the ignored `gradle.properties` path. That way it's easy 
to update the template without messing around with gitignore.
   
   I've taken a closer look at the properties file. Currently I see that only 
two of the settings are generated dynamically, and the rest are all hardcoded.
   ```
           // Approximate a common-sense default for running gradle/tests with 
parallel
           // workers: half the count of available cpus but not more than 12.
           def cpus = Runtime.runtime.availableProcessors()
           def maxWorkers = (int) Math.max(1d, Math.min(cpus * 0.5d, 12))
           def testsJvms = (int) Math.max(1d, Math.min(cpus * 0.5d, 12))
   ...
   # Maximum number of parallel gradle workers.
   org.gradle.workers.max=${maxWorkers}
   
   # Maximum number of test JVMs forked per test task.
   tests.jvms=${testsJvms}
   ```
   Getting the number of "processors" (depending on whether hyperthreading 
counts...) shouldn't be a problem on bash, 
https://stackoverflow.com/questions/6481005/how-to-obtain-the-number-of-cpus-cores-in-linux-from-the-command-line,
 so I could still seed in those values.
   
   I'm using Ubuntu in WSL:
   ```
   me:~$ getconf _NPROCESSORS_ONLN
   16
   me:~$ nproc
   16
   me:~$ grep -c ^processor /proc/cpuinfo
   16
   me:~$ grep ^cpu\\scores /proc/cpuinfo | uniq |  awk '{print $4}'
   8
   ```
   
   For Windows it's also possible: 
https://pureinfotech.com/check-many-cores-processor-windows-10/
   ```
   wmic cpu get NumberOfCores,NumberOfLogicalProcessors /format:value
   NumberOfCores=8
   NumberOfLogicalProcessors=16
   ```
   
   `Runtime.runtime.availableProcessors()` gives the same answer as `nproc`, 
but it was halved (and capped to 12). So I could just use the number of cores, 
or divide `nproc`.
   
   Doing the string replacement when copying the file in bash shouldn't be a 
problem, I'll see if I can do it sensibly in batch as well.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to