Speaker: Gea-Suan Lin (@gslin), KKBOX Inc. Topic: API Design Optimized for Mobile Platform Conference: MOPCON 2012 (in Kaohsiung, Taiwan)
How to design API optimized for mobile platform.
API Design Optimizedfor Mobile PlatformGea-Suan LinKKBOX, Inc.
View Slide
KKBOX
Mobile Platform
Mobile NetworkMobile Device
Compare to Landline
Network Part
Speed
Reliability
Latency
Device Part
It’s much slower.
So,
To adopt mobileenvironment,
We care about thesetwo different faces
Client Modification
Server Modification
API Modification
First,Merge Operations
Reduce Connections
POST /loginusername=password=GET /check-versionGET /rank/album/top100GET /rank/song/top100GET /rank/artist/top100
Merge to...
POST /loginusername=password=extra=check-version,rank-album-top100,rank-song-top100,rank-artist-top100
It’s dirty.
But it’s much efficient.
Second,Operation withStrict-Increasing Serial
Avoid DuplicateAPI Call
POST /mybox/room/1/messagemessage=serial=
Use database to storethe serial of eachdevice.
Third,Multiple ObjectsDesign
Reduce Client CPUResource
And ReduceConnections
GET /song/1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20
Fourth,Filter Results
Reduce Traffic
Reduce Client CPUResouce
GET /song/1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20/name
Then...
Fifth,Compression
Sixth,Use Port 80 & 443
Reduce Firewall Issue
Thank You!