Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/marschall/seaside-servlet-squeak

run Seaside inside a servlet container
https://github.com/marschall/seaside-servlet-squeak

graalvm seaside servlet squeak

Last synced: about 1 month ago
JSON representation

run Seaside inside a servlet container

Awesome Lists containing this project

README

        

Seaside Servlet Bridge for Squeak
=================================

Run [Seaside](http://www.seaside.st) in a Servlet container using [TruffleSqueak](https://github.com/hpi-swa/trufflesqueak).

Usage
-----

Add the dependency to your project

```xml

com.github.marschall
seaside-servlet-squeak
0.2.0

```

Add the servlet to your `web.xml`

```xml

SeasideGraalSqueakBridgeServlet
com.github.marschall.seaside.servlet.squeak.SeasideGraalSqueakBridgeServlet

smalltalk.ImagePath
/WEB-INF/squeak/graalsqueak-1.0.0-rc2-seaside.image

false

SeasideGraalSqueakBridgeServlet
/*

```

* load GraalSqueak-Core
* load Seaside

```
Installer ensureRecentMetacello.
Metacello new
baseline:'Seaside3';
repository: 'github://SeasideSt/Seaside:develop/repository';
load
```

* load `Servlet-Seaside` from this repository
* stop `WAWebServerAdaptor` as it fails during startup on TruffleSqueak

And run with GraalVM.

Make sure you explode WARs for Tomcat, this means having `unpackWARs="true"` on the `` element of `server.xml`. See [Tomcat Web Application Deployment](https://tomcat.apache.org/tomcat-9.0-doc/deployer-howto.html).

Make sure you have TruffleSqueak installed in GraalVM.

Have a look at [marschall/seaside-servlet-squeak-demo](https://github.com/marschall/seaside-servlet-squeak-demo) for a complete demo project.

Requirements
------------

* GraalVM 22.2
* TruffleSqueak
* `gu install -u https://github.com/hpi-swa/graalsqueak/releases/download/1.0.0-rc2/graalsqueak-component-1.0.0-rc2-for-GraalVM-19.2.0.1.jar`
* Jakarka Servlet 5

Limitations
-----------

* Limitations inherited from TruffleSqueak
* As TruffleSqueak is currently not thread safe we are limited to one concurrent request. This is especially damning in case of blocking IO like database access.
* Stack traces currently are not very useful.
* Continuations are not supported.
* Initial performance before warm up is not good compared to OpenSmalltalk VM.
* Startup is not good compared to OpenSmalltalk VM.
* Memory consumption and allocation rate are higher compared to OpenSmalltalk VM
* Asynchronous web request processing is not supported.

JMX
---

Included is a small framework to register Squeak objects as MBeans. To create a custom one:

* sublcass `WAMBean`
* override `#objectName`, check out the [ObjectName](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/javax/management/ObjectName.html) class comment for information about the syntax
* add methods with `` and `` pragmas
* have a look at `WAAdminMBean` for an example

Tips & Tricks
-------------

Enable Graal compilation logging

export CATALINA_OPTS="-Dgraal.TraceTruffleCompilation=true"

To make WAUrlDecodingFunctionalTest pass use, this is not needed in general

export CATALINA_OPTS="-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true"

If you have the Tomcat examples application installed (per default) this overrides the Seaside examples.

Warm up the compiler

for run in {1..100}; do curl -L 'http://127.0.0.1:8080/tests/functional/WALotsaLinksFunctionalTest?_s=_eYKKM3Gl3XzVM5T&_k=JIp_6FO_QQ26nQob' > /dev/null; done

Include the session key to avoid session creation and follow redirects.

Running the image directly with GraalVM

$JAVA_HOME/bin/graalsqueak --jvm --polyglot src/main/webapp/WEB-INF/squeak/graalsqueak-1.0.0-rc2-seaside.image

Building a native Tomcat image https://ci.apache.org/projects/tomcat/tomcat9/docs/graal.html