New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement thin client #4227

Merged
merged 6 commits into from Jun 27, 2018

Conversation

Projects
None yet
1 participant
@eed3si9n
Member

eed3si9n commented Jun 25, 2018

This feature is experimental

Ref #3915
Fixes #2798
Fixes #3508

This adds a new mode to sbt called -client. When sbt is started with -client command, it no longer to loads the build, and instead tries to connect to an instance of sbt server over JSON-RPC. When the server is not running (portfile is not found), it will fork a new instance of sbt entirely in a new JVM.

$ time sbt -client clean
Getting org.scala-sbt sbt 1.2.0-SNAPSHOT  (this may take some time)...
:: retrieving :: org.scala-sbt#boot-app
	confs: [default]
	79 artifacts copied, 0 already retrieved (28214kB/114ms)
[info] entering *experimental* thin client - BEEP WHIRR
[info] server was not detected. starting an instance
[info] waiting for the server...
[info] waiting for the server...
[info] waiting for the server...
[info] waiting for the server...
[info] server found
> clean
[success] completed
sbt -client clean  9.23s user 2.33s system 22% cpu 50.558 total

# server stays
$ ps | rg java
21860 ttys015    1:22.43 java -Xms2048M -Xmx2048M -Xss2M -jar /usr/local/Cellar/sbt/1.1.6/libexec/bin/sbt-launch.jar
22014 ttys015    0:00.00 rg java

$ time sbt -client clean
[info] entering *experimental* thin client - BEEP WHIRR
> clean
[info] Updating ...
[info] Done updating.
[success] completed
sbt -client clean  3.39s user 1.75s system 104% cpu 4.898 total

$ time sbt -client compile
[info] entering *experimental* thin client - BEEP WHIRR
> compile
[info] Updating ...
[info] Done updating.
[info] Compiling 3 Scala sources to /Users/eed3si9n/work/hellotest/target/scala-2.12/classes ...
[info] Done compiling.
[success] completed
sbt -client compile  4.64s user 1.59s system 104% cpu 5.982 total

$ time sbt -client shutdown
[info] entering *experimental* thin client - BEEP WHIRR
> shutdown
[success] completed
sbt -client shutdown  3.04s user 1.65s system 108% cpu 4.300 total

# after shutdown the server is gone
$ ps | rg java
22342 ttys015    0:00.00 rg java

eed3si9n added some commits Jun 24, 2018

Fork server if it's not running
Fixes #3508

This forks an instance of sbt in the background when it's not running already.

```
$ time sbt -client compile
Getting org.scala-sbt sbt 1.2.0-SNAPSHOT  (this may take some time)...
:: retrieving :: org.scala-sbt#boot-app
	confs: [default]
	79 artifacts copied, 0 already retrieved (28214kB/130ms)
[info] entering *experimental* thin client - BEEP WHIRR
[info] server was not detected. starting an instance
[info] waiting for the server...
[info] waiting for the server...
[info] server found
> compile
[success] completed
sbt -client compile  9.25s user 2.39s system 33% cpu 34.893 total
$ time sbt -client compile
[info] entering *experimental* thin client - BEEP WHIRR
> compile
[success] completed
sbt -client compile  3.55s user 1.68s system 107% cpu 4.889 total
```

@eed3si9n eed3si9n merged commit b0e0259 into sbt:1.x Jun 27, 2018

3 checks passed

Codacy/PR Quality Review Up to standards. A positive pull request.
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@eed3si9n eed3si9n deleted the eed3si9n:wip/thin branch Jun 27, 2018

@eed3si9n eed3si9n removed the in progress label Jun 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment