Seaside Servlet Bridge for Squeak

Runs a Squeak Seaside image in a servlet.

License

License

MIT
Categories

Categories

IDE Development Tools
GroupId

GroupId

com.github.marschall
ArtifactId

ArtifactId

seaside-servlet-squeak
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

Seaside Servlet Bridge for Squeak
Runs a Squeak Seaside image in a servlet.
Project URL

Project URL

https://github.com/marschall/seaside-servlet-squeak
Source Code Management

Source Code Management

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

Download seaside-servlet-squeak

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.marschall/seaside-servlet-squeak/ -->
<dependency>
    <groupId>com.github.marschall</groupId>
    <artifactId>seaside-servlet-squeak</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.marschall/seaside-servlet-squeak/
implementation 'com.github.marschall:seaside-servlet-squeak:0.2.0'
// https://jarcasting.com/artifacts/com.github.marschall/seaside-servlet-squeak/
implementation ("com.github.marschall:seaside-servlet-squeak:0.2.0")
'com.github.marschall:seaside-servlet-squeak:jar:0.2.0'
<dependency org="com.github.marschall" name="seaside-servlet-squeak" rev="0.2.0">
  <artifact name="seaside-servlet-squeak" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.marschall', module='seaside-servlet-squeak', version='0.2.0')
)
libraryDependencies += "com.github.marschall" % "seaside-servlet-squeak" % "0.2.0"
[com.github.marschall/seaside-servlet-squeak "0.2.0"]

Dependencies

provided (2)

Group / Artifact Type Version
javax.servlet : javax.servlet-api jar 4.0.1
org.graalvm.sdk : graal-sdk jar 19.2.0.1

test (1)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter jar 5.5.2

Project Modules

There are no modules declared in this project.

Seaside Servlet Bridge for Squeak

Run Seaside in a Servlet container using GraalSqueak.

Usage

Add the dependency to your project

<dependency>
  <groupId>com.github.marschall</groupId>
  <artifactId>seaside-servlet-squeak</artifactId>
  <version>0.2.0</version>
</dependency>

Add the servlet to your web.xml

<servlet>
  <servlet-name>SeasideGraalSqueakBridgeServlet</servlet-name>
  <servlet-class>com.github.marschall.seaside.servlet.squeak.SeasideGraalSqueakBridgeServlet</servlet-class>
  <init-param>
    <param-name>smalltalk.ImagePath</param-name>
    <param-value>/WEB-INF/squeak/graalsqueak-1.0.0-rc2-seaside.image</param-value>
  </init-param>
  <async-supported>false</async-supported>
</servlet>

<servlet-mapping>
  <servlet-name>SeasideGraalSqueakBridgeServlet</servlet-name>
  <url-pattern>/*</url-pattern>
</servlet-mapping>
  • 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 GraalSqueak

And run with GraalVM.

Make sure you explode WARs for Tomcat, this means having unpackWARs="unpackWARs" on the <Host> element of server.xml. See Tomcat Web Application Deployment.

Make sure you have GraalSqueak installed in GraalVM.

Have a look at marschall/seaside-servlet-squeak-demo for a complete demo project.

Requirements

  • GraalVM 19.2.0.1
  • GraalSqueak
  • 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
  • Servlet 3.1, but Servlet 4.0 is recommended

Limitations

  • Limitations inherited from GraalSqueak
    • As GraalSqueak 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 class comment for information about the syntax
  • add methods with <attribute> and <operation> pragmas
  • have a look at WAAdminMBean for an example

Tips & Tricks

Enable Graal compliation 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

Versions

Version
0.2.0
0.1.0