SlideShare a Scribd company logo
1 of 36
Download to read offline
Clojure HTTP API 서버 구현을 위한 라이브러리
/ 김은민
HTTP Server Application
• Framework
• Application Server
• Routing
• Database ORM
• Database Migration
• View Template
Clojure HTTP API Server Application
• Clojure의 접근 방식
• Clojure 언어는 작은 함수들을 조합해 큰 기능을 완성
• 라이브러리 역시 작은 라이브러리를 조합해 큰 기능을 완성
• Clojure HTTP API 서버
• Application Server
• Routing + Servlet abstraction (Java)
• Database ORM
• SQL 사용 / 편리하게 사용할 수 있는 라이브러리 필요
• Database Migration
• View Template
• Lifecycle Library
• API Documentation Library
Clojure HTTP API Server Application
1. Application Server Library
2. Servlet abstraction Library
3. Routing Library
4. SQL Library
5. Database Connection Pool Library
6. Database Migration Library
7. Lifecycle Library
8. API Documentation Library
Clojure HTTP API Server Application
• Framework?
• Luminus (http://www.luminusweb.net)
• Duct (https://github.com/weavejester/duct)
• 왜 사용하지 않았나?
• 웹 사이트 개발에 최적화 되어 있어 불필요한 Library 포함
• API 서버에 더 적합한 라이브러리
• RESTful URI Routing
• API Documentation
• Lumos
• API 서버 구성을 위한 lein template
• Opensource로 공개예정
1. Application Server Library - immutant
• immutant/web - jboss undertow wrapper
사진 출처 : https://github.com/ptaoussanis/clojure-web-server-benchmarks
2. Servlet abstraction Library
• Ring - weavejester (James Reeves)
• 가장 많이 사용되고 있는 서블릿 Wrapper 라이브러리
• 서블릿 Wrapper 기능에 충실하고 단순
• middleware 방식으로 기능 확장
• 기본 컨테이너로 jetty 사용
• 서블릿 2.5 버전 지원
사진 출처 : https://www.booleanknot.com/
2. Servlet abstraction Library
• Pedestal
• Cognitect에서 지원하고 있음
• Servlet wrapper + Routing
• interceptor 방식으로 기능 확장 (ring middleware 호
환)
• 기본 컨테이너로 jetty / tomcat / immutant 선택 가능
• 서블릿 3.1 버전 지원
• ring request/response 사용
3. Routing Library - compojure
• compojure
• Ring을 만든 weavejester가 작성
• Ring과 함께 가장 많이 사용
• Routing 기능만 하는 단순한 라이브러리
• Parameter destructuring
• URI constraint
3. Routing Library - compojure
3. Routing Library - pedestal
• Pedestal
• Pedestal 라이브러리에 포함
• URI constraint
• 트리 형태로 Routing을 표현
• RESTful URI를 표현하기 더 좋음
• 하나의 URI resource에 여러 동작을 표현
• sub-resource 표현
3. Routing Library - pedestal
3. Routing Library - liberator
• Liberator
• Restful Routing에 특화된 라이브러리
• Compojure와 함께 사용
3. Routing Library - liberator
3. Routing Library - etc
• https://github.com/juxt/bidi
사진 출처 : https://github.com/juxt/bidi
4. SQL Library - sqlkorma
• sqlkorma
• SQL에 대응하는 매크로들을 제공
• clojure.jdbc 함수들을 직접 호출할 필요가 없음
• 관계 정의 기능
• 데이터베이스 연결을 defdb를 사용해 Var를 만들기 때문에
connection 관리가 불편함
4. SQL Library - sqlkorma
4. SQL Library - honeysql
• honeysql
• SQL에 대응하는 매크로로 SQL문을 생성하는 라이브러리
• clojure.jdbc를 직접 사용해야 함
• 단순히 SQL문을 생성하기 때문에 다른 database 라이브러리와
조화롭게 사용 가능
5. Database Connection Pool Library
• Apache DBCP
• HikariCP
• BoneCP
• c3p0
사진 출처 : https://github.com/brettwooldridge/HikariCP-benchmark
5. Database Connection Pool Library - HikariCP
• HikariCP
• 가볍고 벤치 마크 결과도 좋고 Clojure Wrapper도 잘 되있음
• Weavejester의 component 기반 웹 프레임워크인 duct에서
사용하고 있음
사진 출처 : https://github.com/brettwooldridge/HikariCP-benchmark
5. Database Connection Pool Library - HikariCP
• duct-hikaricp-component
6. Database Migration Library
• migratus / ragtime
• 두 라이브러리 모두 비슷한 형태와 기능을 하고 있음
• Lumius Library는 migratus를 사용
• weavejester의 Ragtime 라이브러리를 선택
6. Database Migration Library - ragtime
7. Lifecycle Library
• Model-View-Controller
• Clojure Var!
• Server에서 사용하는 상태 있는 Resource가 많다.
• Connection Pool / Server Resource Life Cycle 관리
7. Lifecycle Library - component
• Stuart Sierra component
• Lifecycle 관리를 위한 라이브러리
• Lifecycle 프로토콜(start/stop)을 구현
• system으로 component의 의존 관계를 정하고 start/stop
• system start를 하면 모든 component에 start 함수가
의존 관계에 따라 순서대로 호출
• Application 전체 구조가 component에 의존적인 단점
7. Lifecycle Library - component
• Database Component
7. Lifecycle Library - component
• Server Component
7. Lifecycle Library - component
• System
8. API Documentation Library
• Swagger (http://swagger.io)
• HTTP API를 정의하는 Spec
• Swaager UI / Codegen / Editor등의 많은 툴이 있음
• fnhouse (https://github.com/Prismatic/fnhouse)
• 문서 제공 보다는 Request/Response 체크에 중점을 둔 라이
브러리
• swagger 변환 라이브러리가 있음
8. API Documentation Library - swagger
자료 및 사진 출처 : http://petstore.swagger.io
8. API Documentation Library - pedestal-swagger
• pedestal-swagger
• prismatic/schema 기반
• pedestal 핸들러와 인터셉터 별로 spec을 지정 할 수 있음
• Swagger UI 제공
Clojure HTTP API Server Application
• immutant2 Application Server Library
• pedestal Servlet abstraction Library + Routing
Library
• duct-hikaricp-component Database Connection Pool
Library
• honeysql SQL Library
• ragtime Database Migration Library
• component Lifecycle Library
• pedestal-swagger API Documentation Library
Library 선택의 고민
• Contextual vs Composable
• Composable
• Pro: 유연 / 유지보수/ 다목적 / 익숙한 사
람은 빠름
• Con: 큰 책임이 따른다 / 경험이 적은 사람
들에게는 훈련이 필요 / 정해진 규칙이 없음
- 잘 못 사용할 가능성
• Contextual
• Pro: 문제가 해결되어 있음 / 사용이 편리함
• Con: 다른 문제를 해결 하지 못함 / 유지보
수가 필요함
자료 및 사진 출처 : http://javing.blogspot.kr/2014/01/contextual-vs-composable-design.html
Library 선택의 고민
Contextual Composable
GUI Terminal
Framework Programmatical approach
Wizard copy&paste files into directories
Pedstal Ring / Compojure
liberator Pedestal
sqlkorma honeysql
자료 및 사진 출처 : http://javing.blogspot.kr/2014/01/contextual-vs-composable-design.html
라이브러리
• pedestal 

(https://github.com/pedestal/pedestal)
• component 

(https://github.com/stuartsierra/component)
• pedestal-swagger 

(https://github.com/frankiesardo/pedestal-swagger)
• duct-hikaricp-component 

(https://github.com/weavejester/duct-hikaricp-component)
• ragtime 

(https://github.com/weavejester/ragtime)
• honeysql 

(https://github.com/jkk/honeysql)
Thanks
• Lisp을 좋아하는 사람들의 그룹(한국 리스퍼)
• https://groups.google.com/forum/#!forum/lisp-
korea
• Clojure Korea (facebook group)
• https://www.facebook.com/groups/defnclojure

More Related Content

What's hot

Restful web service
Restful web serviceRestful web service
Restful web servicesunguen lee
 
Swc발표자료2 2(restful)
Swc발표자료2 2(restful)Swc발표자료2 2(restful)
Swc발표자료2 2(restful)마경근 마
 
Node.js DBMS short summary
Node.js DBMS short summaryNode.js DBMS short summary
Node.js DBMS short summaryHoChul Shin
 
I am ASP.NET Core Razor Pages
I am ASP.NET Core Razor Pages I am ASP.NET Core Razor Pages
I am ASP.NET Core Razor Pages SangHoon Han
 
Metaworks3 Framework workbook 2015
Metaworks3 Framework workbook 2015Metaworks3 Framework workbook 2015
Metaworks3 Framework workbook 2015uEngine Solutions
 
Spring 4.x Web Application 살펴보기
Spring 4.x Web Application  살펴보기Spring 4.x Web Application  살펴보기
Spring 4.x Web Application 살펴보기Ji Heon Kim
 
스프링 코어 강의 3부 - 웹 애플리케이션 아키텍처
스프링 코어 강의 3부 - 웹 애플리케이션 아키텍처 스프링 코어 강의 3부 - 웹 애플리케이션 아키텍처
스프링 코어 강의 3부 - 웹 애플리케이션 아키텍처 Sungchul Park
 
SOAP 기반/ RESTful기반 웹서비스 비교
SOAP 기반/ RESTful기반 웹서비스 비교SOAP 기반/ RESTful기반 웹서비스 비교
SOAP 기반/ RESTful기반 웹서비스 비교seungdols
 
API Gateway 그리고 모바일 어플리케이션
API Gateway 그리고 모바일 어플리케이션API Gateway 그리고 모바일 어플리케이션
API Gateway 그리고 모바일 어플리케이션BDapis inc.
 
모바일 Rpg 게임서버 제작
모바일 Rpg 게임서버 제작모바일 Rpg 게임서버 제작
모바일 Rpg 게임서버 제작기환 천
 
Ksug 세미나 (윤성준) (20121208)
Ksug 세미나 (윤성준) (20121208)Ksug 세미나 (윤성준) (20121208)
Ksug 세미나 (윤성준) (20121208)Sungjoon Yoon
 
Spring boot 5장 cli
Spring boot 5장 cliSpring boot 5장 cli
Spring boot 5장 cliChoonghyun Yang
 

What's hot (15)

Restful web service
Restful web serviceRestful web service
Restful web service
 
Swc발표자료2 2(restful)
Swc발표자료2 2(restful)Swc발표자료2 2(restful)
Swc발표자료2 2(restful)
 
Node.js DBMS short summary
Node.js DBMS short summaryNode.js DBMS short summary
Node.js DBMS short summary
 
Restful API guide
Restful API guideRestful API guide
Restful API guide
 
I am ASP.NET Core Razor Pages
I am ASP.NET Core Razor Pages I am ASP.NET Core Razor Pages
I am ASP.NET Core Razor Pages
 
Metaworks3 Framework workbook 2015
Metaworks3 Framework workbook 2015Metaworks3 Framework workbook 2015
Metaworks3 Framework workbook 2015
 
Spring 4.x Web Application 살펴보기
Spring 4.x Web Application  살펴보기Spring 4.x Web Application  살펴보기
Spring 4.x Web Application 살펴보기
 
스프링 코어 강의 3부 - 웹 애플리케이션 아키텍처
스프링 코어 강의 3부 - 웹 애플리케이션 아키텍처 스프링 코어 강의 3부 - 웹 애플리케이션 아키텍처
스프링 코어 강의 3부 - 웹 애플리케이션 아키텍처
 
SOAP 기반/ RESTful기반 웹서비스 비교
SOAP 기반/ RESTful기반 웹서비스 비교SOAP 기반/ RESTful기반 웹서비스 비교
SOAP 기반/ RESTful기반 웹서비스 비교
 
RESTful API
RESTful APIRESTful API
RESTful API
 
API Gateway 그리고 모바일 어플리케이션
API Gateway 그리고 모바일 어플리케이션API Gateway 그리고 모바일 어플리케이션
API Gateway 그리고 모바일 어플리케이션
 
모바일 Rpg 게임서버 제작
모바일 Rpg 게임서버 제작모바일 Rpg 게임서버 제작
모바일 Rpg 게임서버 제작
 
Ksug 세미나 (윤성준) (20121208)
Ksug 세미나 (윤성준) (20121208)Ksug 세미나 (윤성준) (20121208)
Ksug 세미나 (윤성준) (20121208)
 
Spring boot 5장 cli
Spring boot 5장 cliSpring boot 5장 cli
Spring boot 5장 cli
 
Node.js 기본
Node.js 기본Node.js 기본
Node.js 기본
 

Similar to Clojure HTTP API 서버 구현을 위한 라이브러리

Django로 배우는 쉽고 빠른 웹개발 study 자료
Django로 배우는 쉽고 빠른 웹개발 study 자료Django로 배우는 쉽고 빠른 웹개발 study 자료
Django로 배우는 쉽고 빠른 웹개발 study 자료Han Sung Kim
 
웹 크롤링 (Web scraping) 의 이해
웹 크롤링 (Web scraping) 의 이해웹 크롤링 (Web scraping) 의 이해
웹 크롤링 (Web scraping) 의 이해2minchul
 
AWS와 Open Source - 윤석찬 (OSS개발자 그룹)
AWS와 Open Source - 윤석찬 (OSS개발자 그룹)AWS와 Open Source - 윤석찬 (OSS개발자 그룹)
AWS와 Open Source - 윤석찬 (OSS개발자 그룹)Amazon Web Services Korea
 
github : 유용한 기능들
github : 유용한 기능들 github : 유용한 기능들
github : 유용한 기능들 SeongHyun Ahn
 
Selenium을 이용한 동적 사이트 크롤러 만들기
Selenium을 이용한 동적 사이트 크롤러 만들기Selenium을 이용한 동적 사이트 크롤러 만들기
Selenium을 이용한 동적 사이트 크롤러 만들기Gyuhyeon Jeon
 
[M] 프레임워크와 라이브러리(Framework and Library)
[M] 프레임워크와 라이브러리(Framework and Library)[M] 프레임워크와 라이브러리(Framework and Library)
[M] 프레임워크와 라이브러리(Framework and Library)태욱 김
 
Spring Boot 기초 코드랩 (2019-10-26)
Spring Boot 기초 코드랩 (2019-10-26)Spring Boot 기초 코드랩 (2019-10-26)
Spring Boot 기초 코드랩 (2019-10-26)양재동 코드랩
 
웹소켓 (WebSocket)
웹소켓 (WebSocket)웹소켓 (WebSocket)
웹소켓 (WebSocket)jeongseokoh
 
인프콘 2022 - Rust 크로스 플랫폼 프로그래밍
인프콘 2022 - Rust 크로스 플랫폼 프로그래밍인프콘 2022 - Rust 크로스 플랫폼 프로그래밍
인프콘 2022 - Rust 크로스 플랫폼 프로그래밍Chris Ohk
 
Azure를 이용한 Join 없는 글로벌 분산 시스템 설계하기
Azure를 이용한 Join 없는 글로벌 분산 시스템 설계하기Azure를 이용한 Join 없는 글로벌 분산 시스템 설계하기
Azure를 이용한 Join 없는 글로벌 분산 시스템 설계하기Gyuwon Yi
 
코드로 인프라 관리하기 - 자동화 툴 소개
코드로 인프라 관리하기 - 자동화 툴 소개코드로 인프라 관리하기 - 자동화 툴 소개
코드로 인프라 관리하기 - 자동화 툴 소개태준 문
 
[Td 2015]각이 다른 mvc6! 그 여섯 번째 이야기!(최지훈)
[Td 2015]각이 다른 mvc6! 그 여섯 번째 이야기!(최지훈)[Td 2015]각이 다른 mvc6! 그 여섯 번째 이야기!(최지훈)
[Td 2015]각이 다른 mvc6! 그 여섯 번째 이야기!(최지훈)Sang Don Kim
 
Source To URL Without Dockerfile
Source To URL Without DockerfileSource To URL Without Dockerfile
Source To URL Without DockerfileWon-Chon Jung
 
[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대
[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대
[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대CONNECT FOUNDATION
 
[Pgday.Seoul 2017] 5. 테드폴허브(올챙이) PostgreSQL 확장하기 - 조현종
[Pgday.Seoul 2017] 5. 테드폴허브(올챙이) PostgreSQL 확장하기 - 조현종[Pgday.Seoul 2017] 5. 테드폴허브(올챙이) PostgreSQL 확장하기 - 조현종
[Pgday.Seoul 2017] 5. 테드폴허브(올챙이) PostgreSQL 확장하기 - 조현종PgDay.Seoul
 
TechTalk - 서버를 해킹 당했습니다
TechTalk - 서버를 해킹 당했습니다TechTalk - 서버를 해킹 당했습니다
TechTalk - 서버를 해킹 당했습니다Daesung Park
 
Spring MVC
Spring MVCSpring MVC
Spring MVCymtech
 
[오픈소스컨설팅]인프라 자동화 도구 Chef
[오픈소스컨설팅]인프라 자동화 도구  Chef[오픈소스컨설팅]인프라 자동화 도구  Chef
[오픈소스컨설팅]인프라 자동화 도구 ChefOpen Source Consulting
 
REST with Spring
REST with SpringREST with Spring
REST with Spring강우 김
 

Similar to Clojure HTTP API 서버 구현을 위한 라이브러리 (20)

CouchDB - Introduction - Korean
CouchDB - Introduction - KoreanCouchDB - Introduction - Korean
CouchDB - Introduction - Korean
 
Django로 배우는 쉽고 빠른 웹개발 study 자료
Django로 배우는 쉽고 빠른 웹개발 study 자료Django로 배우는 쉽고 빠른 웹개발 study 자료
Django로 배우는 쉽고 빠른 웹개발 study 자료
 
웹 크롤링 (Web scraping) 의 이해
웹 크롤링 (Web scraping) 의 이해웹 크롤링 (Web scraping) 의 이해
웹 크롤링 (Web scraping) 의 이해
 
AWS와 Open Source - 윤석찬 (OSS개발자 그룹)
AWS와 Open Source - 윤석찬 (OSS개발자 그룹)AWS와 Open Source - 윤석찬 (OSS개발자 그룹)
AWS와 Open Source - 윤석찬 (OSS개발자 그룹)
 
github : 유용한 기능들
github : 유용한 기능들 github : 유용한 기능들
github : 유용한 기능들
 
Selenium을 이용한 동적 사이트 크롤러 만들기
Selenium을 이용한 동적 사이트 크롤러 만들기Selenium을 이용한 동적 사이트 크롤러 만들기
Selenium을 이용한 동적 사이트 크롤러 만들기
 
[M] 프레임워크와 라이브러리(Framework and Library)
[M] 프레임워크와 라이브러리(Framework and Library)[M] 프레임워크와 라이브러리(Framework and Library)
[M] 프레임워크와 라이브러리(Framework and Library)
 
Spring Boot 기초 코드랩 (2019-10-26)
Spring Boot 기초 코드랩 (2019-10-26)Spring Boot 기초 코드랩 (2019-10-26)
Spring Boot 기초 코드랩 (2019-10-26)
 
웹소켓 (WebSocket)
웹소켓 (WebSocket)웹소켓 (WebSocket)
웹소켓 (WebSocket)
 
인프콘 2022 - Rust 크로스 플랫폼 프로그래밍
인프콘 2022 - Rust 크로스 플랫폼 프로그래밍인프콘 2022 - Rust 크로스 플랫폼 프로그래밍
인프콘 2022 - Rust 크로스 플랫폼 프로그래밍
 
Azure를 이용한 Join 없는 글로벌 분산 시스템 설계하기
Azure를 이용한 Join 없는 글로벌 분산 시스템 설계하기Azure를 이용한 Join 없는 글로벌 분산 시스템 설계하기
Azure를 이용한 Join 없는 글로벌 분산 시스템 설계하기
 
코드로 인프라 관리하기 - 자동화 툴 소개
코드로 인프라 관리하기 - 자동화 툴 소개코드로 인프라 관리하기 - 자동화 툴 소개
코드로 인프라 관리하기 - 자동화 툴 소개
 
[Td 2015]각이 다른 mvc6! 그 여섯 번째 이야기!(최지훈)
[Td 2015]각이 다른 mvc6! 그 여섯 번째 이야기!(최지훈)[Td 2015]각이 다른 mvc6! 그 여섯 번째 이야기!(최지훈)
[Td 2015]각이 다른 mvc6! 그 여섯 번째 이야기!(최지훈)
 
Source To URL Without Dockerfile
Source To URL Without DockerfileSource To URL Without Dockerfile
Source To URL Without Dockerfile
 
[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대
[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대
[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대
 
[Pgday.Seoul 2017] 5. 테드폴허브(올챙이) PostgreSQL 확장하기 - 조현종
[Pgday.Seoul 2017] 5. 테드폴허브(올챙이) PostgreSQL 확장하기 - 조현종[Pgday.Seoul 2017] 5. 테드폴허브(올챙이) PostgreSQL 확장하기 - 조현종
[Pgday.Seoul 2017] 5. 테드폴허브(올챙이) PostgreSQL 확장하기 - 조현종
 
TechTalk - 서버를 해킹 당했습니다
TechTalk - 서버를 해킹 당했습니다TechTalk - 서버를 해킹 당했습니다
TechTalk - 서버를 해킹 당했습니다
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 
[오픈소스컨설팅]인프라 자동화 도구 Chef
[오픈소스컨설팅]인프라 자동화 도구  Chef[오픈소스컨설팅]인프라 자동화 도구  Chef
[오픈소스컨설팅]인프라 자동화 도구 Chef
 
REST with Spring
REST with SpringREST with Spring
REST with Spring
 

Clojure HTTP API 서버 구현을 위한 라이브러리

  • 1. Clojure HTTP API 서버 구현을 위한 라이브러리 / 김은민
  • 2. HTTP Server Application • Framework • Application Server • Routing • Database ORM • Database Migration • View Template
  • 3. Clojure HTTP API Server Application • Clojure의 접근 방식 • Clojure 언어는 작은 함수들을 조합해 큰 기능을 완성 • 라이브러리 역시 작은 라이브러리를 조합해 큰 기능을 완성 • Clojure HTTP API 서버 • Application Server • Routing + Servlet abstraction (Java) • Database ORM • SQL 사용 / 편리하게 사용할 수 있는 라이브러리 필요 • Database Migration • View Template • Lifecycle Library • API Documentation Library
  • 4. Clojure HTTP API Server Application 1. Application Server Library 2. Servlet abstraction Library 3. Routing Library 4. SQL Library 5. Database Connection Pool Library 6. Database Migration Library 7. Lifecycle Library 8. API Documentation Library
  • 5. Clojure HTTP API Server Application • Framework? • Luminus (http://www.luminusweb.net) • Duct (https://github.com/weavejester/duct) • 왜 사용하지 않았나? • 웹 사이트 개발에 최적화 되어 있어 불필요한 Library 포함 • API 서버에 더 적합한 라이브러리 • RESTful URI Routing • API Documentation • Lumos • API 서버 구성을 위한 lein template • Opensource로 공개예정
  • 6. 1. Application Server Library - immutant • immutant/web - jboss undertow wrapper 사진 출처 : https://github.com/ptaoussanis/clojure-web-server-benchmarks
  • 7. 2. Servlet abstraction Library • Ring - weavejester (James Reeves) • 가장 많이 사용되고 있는 서블릿 Wrapper 라이브러리 • 서블릿 Wrapper 기능에 충실하고 단순 • middleware 방식으로 기능 확장 • 기본 컨테이너로 jetty 사용 • 서블릿 2.5 버전 지원 사진 출처 : https://www.booleanknot.com/
  • 8. 2. Servlet abstraction Library • Pedestal • Cognitect에서 지원하고 있음 • Servlet wrapper + Routing • interceptor 방식으로 기능 확장 (ring middleware 호 환) • 기본 컨테이너로 jetty / tomcat / immutant 선택 가능 • 서블릿 3.1 버전 지원 • ring request/response 사용
  • 9. 3. Routing Library - compojure • compojure • Ring을 만든 weavejester가 작성 • Ring과 함께 가장 많이 사용 • Routing 기능만 하는 단순한 라이브러리 • Parameter destructuring • URI constraint
  • 10. 3. Routing Library - compojure
  • 11. 3. Routing Library - pedestal • Pedestal • Pedestal 라이브러리에 포함 • URI constraint • 트리 형태로 Routing을 표현 • RESTful URI를 표현하기 더 좋음 • 하나의 URI resource에 여러 동작을 표현 • sub-resource 표현
  • 12. 3. Routing Library - pedestal
  • 13. 3. Routing Library - liberator • Liberator • Restful Routing에 특화된 라이브러리 • Compojure와 함께 사용
  • 14. 3. Routing Library - liberator
  • 15. 3. Routing Library - etc • https://github.com/juxt/bidi 사진 출처 : https://github.com/juxt/bidi
  • 16. 4. SQL Library - sqlkorma • sqlkorma • SQL에 대응하는 매크로들을 제공 • clojure.jdbc 함수들을 직접 호출할 필요가 없음 • 관계 정의 기능 • 데이터베이스 연결을 defdb를 사용해 Var를 만들기 때문에 connection 관리가 불편함
  • 17. 4. SQL Library - sqlkorma
  • 18. 4. SQL Library - honeysql • honeysql • SQL에 대응하는 매크로로 SQL문을 생성하는 라이브러리 • clojure.jdbc를 직접 사용해야 함 • 단순히 SQL문을 생성하기 때문에 다른 database 라이브러리와 조화롭게 사용 가능
  • 19. 5. Database Connection Pool Library • Apache DBCP • HikariCP • BoneCP • c3p0 사진 출처 : https://github.com/brettwooldridge/HikariCP-benchmark
  • 20. 5. Database Connection Pool Library - HikariCP • HikariCP • 가볍고 벤치 마크 결과도 좋고 Clojure Wrapper도 잘 되있음 • Weavejester의 component 기반 웹 프레임워크인 duct에서 사용하고 있음 사진 출처 : https://github.com/brettwooldridge/HikariCP-benchmark
  • 21. 5. Database Connection Pool Library - HikariCP • duct-hikaricp-component
  • 22. 6. Database Migration Library • migratus / ragtime • 두 라이브러리 모두 비슷한 형태와 기능을 하고 있음 • Lumius Library는 migratus를 사용 • weavejester의 Ragtime 라이브러리를 선택
  • 23. 6. Database Migration Library - ragtime
  • 24. 7. Lifecycle Library • Model-View-Controller • Clojure Var! • Server에서 사용하는 상태 있는 Resource가 많다. • Connection Pool / Server Resource Life Cycle 관리
  • 25. 7. Lifecycle Library - component • Stuart Sierra component • Lifecycle 관리를 위한 라이브러리 • Lifecycle 프로토콜(start/stop)을 구현 • system으로 component의 의존 관계를 정하고 start/stop • system start를 하면 모든 component에 start 함수가 의존 관계에 따라 순서대로 호출 • Application 전체 구조가 component에 의존적인 단점
  • 26. 7. Lifecycle Library - component • Database Component
  • 27. 7. Lifecycle Library - component • Server Component
  • 28. 7. Lifecycle Library - component • System
  • 29. 8. API Documentation Library • Swagger (http://swagger.io) • HTTP API를 정의하는 Spec • Swaager UI / Codegen / Editor등의 많은 툴이 있음 • fnhouse (https://github.com/Prismatic/fnhouse) • 문서 제공 보다는 Request/Response 체크에 중점을 둔 라이 브러리 • swagger 변환 라이브러리가 있음
  • 30. 8. API Documentation Library - swagger 자료 및 사진 출처 : http://petstore.swagger.io
  • 31. 8. API Documentation Library - pedestal-swagger • pedestal-swagger • prismatic/schema 기반 • pedestal 핸들러와 인터셉터 별로 spec을 지정 할 수 있음 • Swagger UI 제공
  • 32. Clojure HTTP API Server Application • immutant2 Application Server Library • pedestal Servlet abstraction Library + Routing Library • duct-hikaricp-component Database Connection Pool Library • honeysql SQL Library • ragtime Database Migration Library • component Lifecycle Library • pedestal-swagger API Documentation Library
  • 33. Library 선택의 고민 • Contextual vs Composable • Composable • Pro: 유연 / 유지보수/ 다목적 / 익숙한 사 람은 빠름 • Con: 큰 책임이 따른다 / 경험이 적은 사람 들에게는 훈련이 필요 / 정해진 규칙이 없음 - 잘 못 사용할 가능성 • Contextual • Pro: 문제가 해결되어 있음 / 사용이 편리함 • Con: 다른 문제를 해결 하지 못함 / 유지보 수가 필요함 자료 및 사진 출처 : http://javing.blogspot.kr/2014/01/contextual-vs-composable-design.html
  • 34. Library 선택의 고민 Contextual Composable GUI Terminal Framework Programmatical approach Wizard copy&paste files into directories Pedstal Ring / Compojure liberator Pedestal sqlkorma honeysql 자료 및 사진 출처 : http://javing.blogspot.kr/2014/01/contextual-vs-composable-design.html
  • 35. 라이브러리 • pedestal 
 (https://github.com/pedestal/pedestal) • component 
 (https://github.com/stuartsierra/component) • pedestal-swagger 
 (https://github.com/frankiesardo/pedestal-swagger) • duct-hikaricp-component 
 (https://github.com/weavejester/duct-hikaricp-component) • ragtime 
 (https://github.com/weavejester/ragtime) • honeysql 
 (https://github.com/jkk/honeysql)
  • 36. Thanks • Lisp을 좋아하는 사람들의 그룹(한국 리스퍼) • https://groups.google.com/forum/#!forum/lisp- korea • Clojure Korea (facebook group) • https://www.facebook.com/groups/defnclojure