glassfish in production environments

Post on 11-May-2015

5.108 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Get to know GlassFish Community, the differences between Oracle GlassFish Server, and also all the capabilities for Management, Administrative tasks, Monitoring, Tuning and Configuration for Production Environments of all your Java EE applications

TRANSCRIPT

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.1

GlassFish in Production EnvironmentsBruno BorgesPrincipal Product ManagerJava Evangelist

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.2

The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.3

OpenSourceProject

Commercial Product

GlassFish Server

ReferenceImplementation

GlassFish

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.4

GlassFish ServerReference Implementation

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.5

Java EE – And GlassFish - Journey

Java EE 7

2005-2012

Ease ofDevelopment

Lightweight

Developer Productivity & HTML5

32 specs

1998-2004

Enterprise Java Platform

Robustness

Web Services J2EE

20 specs EE 5, EE 6

28 specs

2013 - Future

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.6

Java EE 7 ThemesJava EE 7 Themes

DEVELOPER PRODUCTIVITY

MEETING ENTERPRISE DEMANDS

Java EE 7

Batch Concurrency Simplified JMS

More annotated POJOs Less boilerplate code Cohesive integrated

platform

WebSockets JSON Servlet 3.1 NIO REST

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.7

Java EE 7 Community Momentum

AC

TIV

E P

RO

JEC

TS

26

Active and transparent mailing lists

JSR

s AD

OP

TE

D

22

JUG

s

19

Adopt a JSR

PR

OM

OT

ED

BU

ILD

S89

GlassFish

YOU

187

CO

MP

AN

IES

32

EX

PE

RT

S

SP

EC

LE

AD

S

16

AC

TIV

E JS

Rs

14

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.8

GlassFish ServerOpen Source Project

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.9

GlassFish Server

Built in open source

World’s first Java EE 7 Application Server

Lightweight / modular / easy to use

Production ready

Open Source Project

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.10

The GlassFish Community

10+ million annual downloads

FishCAT - Early testing and fixes

Active user forums

Community contributions

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.11

Centralized management

Integrated GlassFish Server Provisioning Manage instance/cluster lifecycle Manage configurations Manage Java EE resources Manage application lifecycle

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.12

Flexible Administration

Web Browser

REST API

Command Line

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.13

GlassFish Server Administration Architecture

Cluster 1

DomainAdministration

Server

(DAS)

instance4

ssh /dcom /http

http

Repository

instance2

instance3

instance1

RESTJSONXML

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.14

GlassFish Server Clustering

Manage 100 instances per domain– Standalone

– Clusters (max 10 per cluster)

Dynamically resize cluster JMS Broker Clustering Load Balancing

– Commercial plugin

– AJP (mod_jk, mod_proxy)

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.15

Application Versioning

Deploy multiple versions application versions Activate any version For example:

– Roll forward and backwards between versions

– Pre-deploy application for later activation

– Enable new version at specific time of day Deploy versi

on 1

Dep

loy

vers

ion

2

Rollback

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.16

GlassFish Modularity

Starts in seconds Only loads required

modules Including

“infrastructure” features

In a nutshell

OSGi

EJB Servlet

274

JPA

JMS Broker

app1.war

CDI

CDI REST WebSocket Bean Validation

Clustering Console HTTP

app2.ear

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.17

OSGi Support

OSGi Runtime (Apache Felix)– Also runs on others

– Ships with ~275 modules

– Integrates OSGi management tools

Hybrid Java EE / OSGi Applications– Expose EJBs as OSGi Services

– Inject OSGi services into Java EE applications

Run any OSGi bundle Supports OSGi Enterprise

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.18

Extending GlassFish Server

Define a new container– System-level logic

– Implement administration commands

Expose administration capabilities– Administration Console

– Command Line

– RESTful Interface

Embeddable API Re-brand user interface

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.19

Built-in Developer Features

Ultra-fast deployment– Hot deployment

– Directory deployment

– Auto-deploy directory

Run as a single JAR java –jar glassfish.jar app1.war

Maven Plugin mvn gf:run, gf:start, gf:deploy

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.20

Active Redeploy

Maintains state across redeploys

Rapid Iterative development– Edit

– Save

– Refresh

1) Edit

2) Save

3) Refresh

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.21

NetBeans 7.3.1 + GlassFish 4.0

NetBeans bundles GlassFish Incremental compilation; auto-deploy Complete Java EE 7 support

– All Java EE 7 project types

– Maven Support

– Wizards

– Advanced Wizards Entity to REST generation Database to JSF 2.2

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.22

Oracle GlassFish ServerCommercial Product

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.23

Oracle GlassFish Server

Commercial Distribution of GlassFish Server Open Source Edition

GlassFish Server Control Java SE support 24 x 7 x 365 premium support Regular patch releases Indemnification

Java EE 6 Compliant

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.24

Oracle Enterprise Manager 12c

Features– Discovery

Applications not discovered

– OOTB Monitoring (live, historical)

– Event Monitoring

– Configuration management

– Process controle (live, schduled)

EM FMW Plugin 12.1.0.4 GlassFish Open Source and Commercial versions

GlassFish Plugin

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.25

GlassFish Server Control

Performance TunerDAS Backup & RecoveryMonitoring

Scripting Client

ActiveCache for GlassFishOracle Access

Manager IntegrationLoad Balancer

Plugin & Installer

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.26

TUNING FOR PRODUCTION ENVIRONMENTS

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.27

Quick Start and Overview

Download from glassfish.org– ZIP and native installers (Mac, Linux, Windows)

– Download Size Smallest at 37Mb for English Web Profile Biggest at 114Mb for Multilingual Full Profile

Install (requires JDK 7)

– Execute native installer or uncompress ZIP file

Run– $ cd glassfish4

– $ ./bin/asadmin start-domain

Download, Install, Run

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.28

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.29

Default configurations

GlassFish comes by default best configured for development environments

– Default security configurations OTOH come pre-configured

– A default GF domain does not enables remote access for admin

Best for hot deployment Great for integrating and using from within IDEs

Development purpose

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.30

Basic stuff: JVM options

A production domain will need more memory, and other fine tuned options

– Edit <java-config> inside domain.xml manually, or

– Edit through Admin CLI or Web UI

JVM Options

-Xms and -Xmx to same value (at least 2GB)

-XX:MaxPermSize and -XX:MinPermSize to same value (at least 256mb)

More memory for production environments

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.31

Garbage Collector and Heaps

There are several options, but G1 is available for a while and you should consider it. Analyse, compare, and decide

Enable -verboce:gc Enable -XX:+PrintGCDetails Inform -Xloggc:/tmp/my_glassfish_vm_gc.log Make sure devs can’t freeze your VM by enabling

– XX:+DisableExplicitGC

Enable heap dump for when you get OOME

Analyse and consider G1 from HotSpot 7

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.32

Disabling Developer Features

Disable auto-deploy and dynamic application reload Disable JSP check for modified date Enable cache of characters in Strings

– Edit domain1/config/default-web.xml

– genStrAsCharArray=true

– ** this might bring encoding issues

Because this is a production environment

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.33

Request and Acceptor Threads

Define Acceptor Threads to a number similar to the number of Cores in your CPU

Increase the number of threads for the HTTP Listener, to as much as your CPU can handle simultaneously

Set min and max threads pool size to same value

Handling more than <several> users at the same time

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.34

LOGGING

Always disable:

Unnecessary logging

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.35

Monitor, tune, monitor, tune

Always monitor

Keep tuning

Tools– jmap / jps, jstat, jconsole

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.36

CUSTOMERSTORIES

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.37

Customers using GlassFish in Production

Jelastic was the first cloud to provide GlassFish 4.0 with Java EE 7 Pense Imóveis, real estate buyer/seller network Guia da Semana, enterteinment/schedule website Parleys.com CloudBees first to ofer Java EE 7 (Using GlassFish)

Besides Jelastic

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.38

ROADMAP

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.39

GlassFish Server 4.x

2013 2014

GlassFish Server 4.0• Java EE 7• Open Source Edition• Clustering (early access)

GlassFish Server 4.0.1• Bug Fixes

GlassFish Server 4.1• Clustering• Improve modularization• GlassFish Server Control• Oracle GlassFish Server• Bug fixes

Major

Minor

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.40

Future of Java EE

JCACHEStateManagementConfiguration

HTML5 ++Cloud / PaaS

JSONBinding

Java EE 8and Beyond

NoSQL

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.41

top related