Monthly Archives: August 2016

Caucho Newsletter – December 2015

Resin application server - Java EE 6 Web Profile Certified

Happy Holidays! We have lots of updates for you. Here's a snapshot:
 
  • Resin 4.0.47 release
  • Baratine tutorials
  • Speak with a Caucho Engineer!
  • Resin tip of the day
Resin News

Resin 4.0.47 on caucho.com/download

The latest release of Resin v4.0.47 is now available for download. As with previous 4.0 releases, the upgrade process is as simple as stopping Resin, saving your configuration, installing the latest version, and copying over your config.

Many of our clients who have upgraded to this latest version report an increase in performance of their clustered applications.

Check out the following enhancements in 4.0.47:
 
JDK 6 compatibility

Distributed session database synchronization issues, specifically: 

  • session: fixes related to Java deserialization (#5947i)
  • distcache: locking overhead reduced (#5962)
  • distcache: update remove query and locking (#5952)
  • session: fixes related to session removal/timeout (#5952)
  • compile: jdk5 compile issues (#6940)
  • cache/mmap: jdk6 compatibility (#5959, #5960i)
The latest releases of Resin continue to improve performance and reliability as we work hard to fix any bugs that are reported. For this reason, we always recommend users update their Resin installation and take advantage of these improvements.
 

Baratine News


Baratine Patterns Tutorial

The latest version 1.0.3 is available at baratine.io/download. As more users implement and prototype services, we are seeing a common set of questions arise around functionality. Many of these questions relate to the use of Baratine, such as “What JSRs are supported by the Baratine Framework?”  This is actually a basic question in terms of functionality for Baratine. In short, Baratine does not support any of the JSRs specifically. Instead, Baratine supports the use of Java 8 and many programming patterns (http://doc.baratine.io/v0.8/patterns/) that can be used to build services. We believe that as it currently stands a large majority, upwards of 90%, of the web services developers are looking to build can be created with these patterns and the Baratine framework. 

What’s more, rather than coding to specific JSRs, Baratine allows you to code directly to Java 8. This means code is more standard, easier to read, and you’ll automatically enjoy the performance and scalability aspects of Baratine. While there is coding required that is specific to the Baratine framework, we have restricted it to Service level Annotations (http://doc.baratine.io/v0.8/manual/annotations/). These annotations allow developers to quickly and succinctly manage the lifecycle event of a service, similar to how annotations can be used to modify the lifecycle of a servlet.

If you know how to code in Java 8, then you are capable of building fully distributed web services with the ability to speak to any language and perform millions of operations per second per instance. Of course, this is made possible by the underlying Baratine framework which is complex in its coding, but exposes a POJO API that is naturally familiar to many developers.

Currently we are providing 10-15 minute tutorials (http://doc.baratine.io/v0.8/patterns/) that can be used to implement portions of an application or service. Here is the list: 

  • Hello World - How to deploy a Baratine Service and create a client to call into it
  • Single-Page Session - A session service used by a single-page application for user login state. Each user sessions creates a new session service instance
  • Singleton Resource Service - A service with a single resource, used to create new services from existing modules or from scratch
  • Queue with Application API - A user of a queue service submits a request and continues processing without waiting for a result
  • Local Microservice - Wrapping an existing module into a local microservice, similar to external creates encapsulated clean boundaries
  • Microservice - A microservice service is useful to convert an existing multi-threaded, blocking module into a loosely coupled service
  • Protocol for a Module - gives an existing module a HTTP protocol interface that supports HTTP request-response & WebSocket async protocol
  • In-Memory with External Database - An in-memory service layer that encapsulates a database better than a traditional passive cache
  • In-Memory Service with Internal Database - An in-memory service layer that persists data internally rather than an external database
  • Child Services - Build a REST-like Service with multiple child instances, each instance responsible for its own data
  • Setting up a Cluster - how to build a sharded service and deploy it to a cluster
  • Publish/Subscribe Stream - how to build a publish/subscribe service for Java and JavaScript clients
  • Publish/Subscribe Events - how to use publish/subscribe events in your services
  • Data Access Service - how to use Hibernate with Baratine
  • Singleton List Service - A single instance list service that maintains its own data
  • Multiple List Service - A multiple instance list service each independently maintaining their own data
  • REST Service - How to create a REST interface for a service
  • Facade Service - A facade service that allows you to expose an external API to a service, separate than the internal API

Are we missing a pattern? Let us know and we will implement it! :)

Helpful Information 


 

Have Questions Around Setting Up Clustering / HA?

Our Sales and Engineering teams are available to schedule calls with you to discuss Resin and Baratine as they apply to your specific environment. This benefit is included with your license and is a great way to learn about underlying models, features, performance and best practices that could be valuable to your development efforts and deployments.

Send an email to sales@caucho.com to schedule a call or contact us directly at 858-456-0300! Alternatively, if you are planning on being in the San Diego area, drop us a line and come by our offices to meet us in person!

Resin Tip

One of the most useful tools Resin provides for debugging is its logger. Resin has the ability to log any instance of a class and provide a detailed report of method invocation leading into and out of a class. Because of this, the log is usually the first place to look when something has gone awry with an application. By adding a simple one line logger to your resin.xml, you can enable the level of detail our engineers use to sort through various bugs. The following example details how quickly this can be done:

  1. Choose the name of the class or package you wish to log​.
    • Resin will log every class under a package name, i.e. com.foo logs com.foo.bar
  2. Choose the level of detail you wish to have logged.
  3. Add the logger to your resin.xml and restart your application
  4. Resin will output log files to /var/log/jvm-*app-server*.log

Example:
 (in resin.xml)
 
//Log HTTP-related debugging
<logger name="com.caucho.http”.server level=“finer”/>
 
//Log every class that matches com.foo.bar
<logger name="com.foo.bar” level=“finer”/>
 
Alternatively, you can provide logging in a specific class as follows:
 
import java.util.logging.Logger;
import java.util.logging.Level;
 
public class Foo {
  private static final Logger log
    = Logger.getLogger(Foo.class.getName());
 
  …
  void doFoo(String bar)
  {
    // check for log level if your logging call does anything more
    // than pass parameters
    if (log.isLoggable(Level.FINER))
        log.finer(this + "doFoo(" + bar + ")");
 
    …
 
    log.info(…);
 
    try {
        …
    } catch (ExpectedException ex) {
      log.log(Level.FINEST, "expected exception", ex);
    }
  }
  …
}

 


Copyright (c) 1998-2015 Caucho Technology, Inc. All rights reserved.
Caucho®, resin®, quercus® and baratine
TM are registered trademarks of Caucho Technology, Inc.


 Presentations   & Links
 

  Resin 4

Baratine

Baratine Overview

Follow Us!

Facebook: Caucho Technology
Resin Twitter page
Caucho Blog

__________________

Contact Us
(858) 456-0300
sales@caucho.com
www.caucho.com    

    

Caucho Newsletter – April 2016

Resin application server - Java EE 6 Web Profile Certified

Greetings! We have lots of updates for you. Here's a snapshot:
  • Baratine – bringing you the 4-day work week!
  • JSON messaging service capable of 5 million messages/second in 15 lines of code
  • TechEmpower benchmarks
  • Resin 4.0 upgrade success story
  • Resin 4.0 improvements
  • Resin tips
  • Technical paper: Scalability! But at what COST?
Baratine News

 

The 4-day work week is closer than you think   8-)

Caucho is making the 4-day work week a reality. OK, while we can’t guarantee your boss will let you take Fridays off, we can say that major breakthroughs in Baratine are just around the corner and should free up a lot of your time!

Consider your typical LAMP stack (Linux, Apache, MySQL & PHP). Not too long ago these technology stacks were extremely common building blocks in application development. Buidling out a proof of concept was familiar to developers and numerous examples and explanations can be found online. But how do they handle availability, scalability, performance and concurrency? These factors are generally figured out later as improvements to the system. All this work means added complexity and overhead costs.

Baratine is a game changer. It ensures concurrent access to data with no thread management code needed! Baratine persists data to disk without requiring a data schema. Scalability, partitioning, dependency management, performance are all at the forefront of Baratine development. This means you're exposed to an environment that avoids the pitfalls of previous technologies and you'll be done building in no time.

Caucho's experience as one of the first implementers of Servlet and Cloud technology allows us to build such a powerful solution. Resin's success in particular has also allowed us to GPL Baratine as we look to push the next breed of high performing web applications into the world.

What does this mean for you as a developer? 

Happy hour just got happier :-) In short, Baratine is giving you a cheaper (free) and higher performing technology stack that fits more use cases while using less resources than a traditional LAMP stack. We're excited to see where this technology takes your application.

JSON WebSocket Messaging in Baratine

Quick! You need to implement a thread-safe streaming pub/sub (over Websocket) capable of millions of messages per second, isolated as its own service and integrate it with your current application. Oh and it needs to be done yesterday! How fast can you implement this?
 
If you use Baratine, the answer is 5 minutes and ~13 lines of Java code!
 
This is the promise of Baratine, whether you are building single JSON processing pub/sub services or fully fledged auctions (https://github.com/baratine/auction), Baratine has been engineered from the thread and data level up to ensure your application automatically fits reactive manifesto (http://reactivemanifesto.org).
 
Take a look at the Java code below. In three files we are able to create a session service that adheres to our requirements:
 
(Note: we chose to send the current Date at time of request as our message)
 
fooService.java
@Service
public class fooService {
 
               public void Receive(Result<String> r) {
                              
 Date date = newDate();
                             
 r.ok(date.toString());
               }
}
 
client.java
@Service("session:")
public class client implements ServiceWebSocket<String, String>{
 
                @Inject
                fooService fs;
 
                public void open(WebSocket<String> ws) {
                               
                           fs.Receive((x,e) -> {
                                   ws.next(x);
                           });
                }
 
                public static void main(String[] args){
 
                            Web.websocket("/msg").to(client.class);
                            Web.include(fooService.class);
                            Web.start();
                }
 
}
 
 
Index.html
 
<html>
<script type="text/javascript">
 
var connection = new WebSocket("ws://localhost:8080/msg");
 
connection.onmessage = function(e) {
               
          console.log(e.data);
};
</script>
</html>
 
Looking at this code, you might be wondering if Baratine a messaging platform. The answer is no, but it can be used as such. It’s 5mb in package size and since we thought all meaningful applications will need some sort of communication to link services, stream updates, etc., we’ve exposed an API for exactly this purpose.
 
While there are companies out there that will charge you by the message for similar functionality, Baratine is GPL & free to use. We took this example a step further in our documentation and linked it to a RabbitMQ broker (giving you the ability to do big data processing on your existing messages). Take a look at our tutorials and get started with Baratine today! 

TechEmpower Benchmarks

TechEmpower has been running benchmarks for quite some time now, attempting to measure and compare the performance of web frameworks. The term “framework” is used loosely to include platforms and micro-frameworks. Recently, we were able to have Baratine accepted into its next round of benchmark testing (https://github.com/TechEmpower/FrameworkBenchmarks/pull/1927) While benchmarks don’t give an absolute in terms of which framework will be the best for your specific application, it does let you know where a framework measures up for common use cases. If a framework is in the bottom 10% for common use cases, why would you even consider it? If a framework is in the top 10%, it’s worthwhile to be aware of it in case it fits a use case for your business.
 
In any case, look for Baratine to put up some quite impressive numbers in the field. Interestingly enough, TechEmpower uses our Resin Application Server for the servlet model for the following reason:

Resin is a Java application server. The GPL version that we used for our tests is a relatively lightweight Servlet container. We tested on Tomcat as well but ultimately dropped Tomcat from our tests because Resin was slightly faster across all Servlet-based frameworks.
 
Note: If they used Resin Pro, the numbers would be even higher :-)  

 

Resin News


Resin 4.0 Upgrade succuess story

We always recommend upgrading to the latest version of Resin 4.0. Here’s an example of why:
 
“I also wanted to give you some feedback about the triad. In a nutshell, it's been working great and we are glad we moved to a cluster architecture and upgraded to Resin 4.0.47. We normally use about 10% of each server's processing power so that gives us a lot of leeway and scalability for the future. So many thanks to the team for the advice and support!”
 
-Y.G. / (Company details removed for privacy)
 
 If you are running a version of Resin 4.0, the upgrade process simply means running three install commands and copying over your current configuration. For clients running earlier versions of Resin (3.1 or lower) we recommend first installing the latest version of 4.x and deploying your .war file to it. As always, we are available to discuss and provide guidance so that you can take advantage of the upgraded performance features. Contact us at sales@caucho.com or (858) 456-0300 when you’re ready to go!

Resin 4.0 improvements

The latest version of Resin is 4.0.48 and includes bug fixes related to database and session corruption. It can be downloaded at http://caucho.com/products/resin/download. We continue to improve Resinwith bug fixes and feature requests ensuring it remains the best multithreaded Java Application Server in the world.
 
If you’ve noticed any odd behavior in your deployment, please do not hesitate to contact us directly or file a report on our bug site at: http://bugs.caucho.com/main_page.php
 
Note: you'll need to register an account to log bugs

Resin tips

Looking to use Resin’s hot swap technique from within your IDE (no restarts on a redeploy of code)? If you deploy as a directory or deploy from your workspace, then this is possible!
 
Check http://wiki4.caucho.com/Resin:Eclipse_IDE_Plugin for details.
 
Deployment options are in “Configure Server” section. Instead of selecting “use remote deployment”, you’ll want to choose either Deploy as a directory or Deploy from workspace.

This tip can cut down on restarts, similar to JRebel. 

Helpful Information 


 

Technical Paper – Scalability! But at what COST?

COST (Configuration that Outperforms a Single Thread) is a new metric for measuring big data platforms. The paper is quite revealing in both examining your programming model and cost to scale that system. It points out that scaling a system doesn’t guarantee the work will be done faster.
 
This paper dives into the reality of scalable multicore clusters and compares their performance to a single in-memory thread. Surprisingly, many configurations have a large COST, often hundreds of cores and still underperform one thread for all of their reported configurations.
 
You can find a copy of the paper here for your reading: http://www.frankmcsherry.org/assets/COST.pdf
 
It begs the question, are single threaded models the models of the future? Take a look at http://baratine.io and decide for yourself!

 


Copyright (c) 1998-2016 Caucho Technology, Inc. All rights reserved.
Caucho®, resin®, quercus® and baratine
TM are registered trademarks of Caucho Technology, Inc.


 Presentations   & Links
 

  Resin 4

Baratine

Baratine Overview

Follow Us!

Facebook: Caucho Technology
Resin Twitter page
Caucho Blog

__________________

Contact Us
(858) 456-0300
sales@caucho.com
www.caucho.com