9 Design factors on
developing Cloud
applications
Feb 2017
Rick Jang
9 Design factors on developing cloud
applications
1.Don't code your application directly to a specific topology
2.Do not assume the local file system is permanent
3.Don't keep session state in your application
4.Don't log to the file system
5.Don't assume any specific infrastructure dependency
6.Don't use infrastructure APIs from within your application
7.Don't use obscure protocols
8.Don't rely on OS-specific features
9.Don't manually install your application
2
Design factors on developing cloud applications
Don't code your application directly to a specific topology
Use Dynamic Service Binding e.g. Spring DI
3
Design factors on developing cloud applications
Do not assume the local file system is permanent
Use File Storage Services like Amazon S3
4
Design factors on developing cloud applications
Don't keep session state in your application
Use Memory Cache Service like ElastiCache
When you use Cloud Foundry Auto re-configurer,
Session cluster service (Redis) is automatically bound for
java sevlet Session.
Ref. https://blog.pivotal.io/pivotal-cloud-
foundry/products/session-replication-on-cloud-foundry-2
5
Design factors on developing cloud applications
Don't use obscure protocols
Use 80, 443 make as a Micro Service
6
Design factors on developing cloud applications
- 9
Don't manually install your application
Automatically Install your application
dependencies such as DDL, static files
You can use JPA which automatically installs your
entities by generating DDLs
The spring-music.war example shows
automatically installs the static data when it is
connected to MySQL service.
7
Example SaaS App – Essencia Project
Management Tool
•일반 SW개발자들도 쉽게 SW 개발방법론을 정의하여 적용함으로써 SW 생산성을 향상시킬 수 있도록 도움을 줄 수
있는, Essence 표준에 적합한 Practice 및 방법론을 개발하고 조합하며 실행시키는 SEMAT Essence 지원 방법론 재정의
및 실행지원 솔루션 - 'Essencia' 의 개발과 보급이 목표
액터와 시스템 정의
Method Repo.
Method Author
Stakeholders
(Product Owner, PM, Developer)
Method Composer
프랙티스 조립 N-Screen/Web2.0 Portal
실행 / 가이드
모니터링
분석 / 최적화
Practice / Method
Orchestrator
Or 기존 PMS(JIRA)
WorkList SNS Dashboard
Requirement
Tools
Modeling
Tools
Testing
Tools
CI tools
Practice Library
Practice Author
Practice Mapper
에센스-프랙티스 매핑
Example SaaS App – Essencia Project Management Tool – MSA Architecture
Amazon S3 Clear DB
Redis
Memory Cache
Essencia Service
3rd Party Apps
JIRA Issue Tracker
Service
All RESTful
Example SaaS App – Essencia Project Management Tool – On-premise Architecture
Local File System
Local DB
(MySQL)
Essencia on-premise
IStorage DataSource HttpSession
LocalFileStorage org.apache.catali
na.session.Stand
ardSession
DBCPDataS
ource
<bean id="storage" class="org.uengine.modeling.resource.LocalFileStorage"
<property name="localBasePath" value="D:Projectcodi"/>
</bean>
Essencia - Dynamic Service Binding with
Spring DI
<bean id="storage"
class="org.uengine.modeling.resource.AmazonS3Storage">
<property name="amazonS3Bucket"
value="${Amazon.S3.Bucket}"/>
<property name="awsAccessKey"
value="${Amazon.AccessKeyID}"/>
<property name="awsSecretAccessKey"
value="${Amazon.SecretAccessKey}"/>
</bean>
<bean
class="org.cloudfoundry.reconfiguration.spring.AbstractCloudService
BeanFactoryPostProcessor" />
<bean id="storage"
class="org.uengine.modeling.resource.LocalFileStorage">
<property name="localBasePath" value="D:Projectcodi"/>
</bean>
Case of On-premise Case of On Cloud
Essencia – Application Code must not be
affected
@Autowired public Storage storage;
public void delete() throws IOException {
storage.delete(this);
}
Essencia – Using AOP for Metering /
Billing – 1
@Metered("project.start")
public void executeProcess(String instanceId) throws Exception{
ProcessInstance instance = getInstance(instanceId);
instance.execute();
}
Essencia – Using AOP for Metering /
Billing – 2
@Aspect
public class MeteringAdvice {
@Before("@annotation(metered)")
public void checkAvailable(Metered metered) throws
NoServiceAvailableException {
…..
//Check if the service is available for the requested tenant
}
@AfterReturning("@annotation(metered)")
public void meter(Metered metered) throws Exception {
….
//Add usage log
}
}
Essencia – Build & Deploy Automation
Essencia On-Premise
Essencia On Amazon
Essencia On Bluemix
Overrides:
1. applicationContex.xml (to use AmazonS3Storage)
2. Uengine.properties (to change DB connection info)
Overrides:
1. applicationContex.xml (to use services)
2. pom.xml (Cf push command)