rest apis considered infrastructural purposes. not expert, caught principles should implement deal horizontal scaling , performance. supposed suppress kinds of affinities between clients , services (no session, etc...). rest apis considered business perspective.
last week, in team proposed implement part of legacy application rest api. application embedded library (.net) in every application requested it. rest api suffered performance issues (too many round trips between client , server). workaround, caching implemented (on server side). in opinion, violates rest principles. without caching, should have many servers 1 client acceptable performance, parallel requests or load-balancer (or that...).
as speak apis, suppose such apis should driven business needs. based on experience, there business use-cases not suitable rest ?
[edit] api simulating workflow entries coming client...
as workaround, caching implemented (on server side). in opinion, violates rest principles.
actually using cache rest constraint must follow. fielding dissertation 5.1.4 cache: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1_4 suggest read whole dissertation (or @ least rest part) before further questions.
they supposed suppress kinds of affinities between clients , services (no session, etc...).
statelessness moving session rest client, not cannot have session. don't want maintain many client session on server side, if can on client side. makes caching easier.
rest apis considered business perspective.
i assume that's why of big companies have rest apis. e.g. facebook, google, twitter, etc... these apis 3rd party clients. ofc. if api consumed many clients in company using rest can alternative using soa, other rpc or maybe message broker solutions.
last week, in team proposed implement part of legacy application rest api. application embedded library (.net) in every application requested it.
rest building application interface (or delivery method) clients can use, , not building applications. it's purpose similar purpose of soa , other things mentioned. ddd building (big) applications.
the rest api suffered performance issues (too many round trips between client , server). workaround, caching implemented (on server side).
in such situation can rewarding examine cause of performance issues. if send series of messages, because rest api lacks feature, implement feature in rest service or if complicated, not necessary belong low level service, can write upper level rest service, consumes low level service (aka. layered system constraint). if problem many users, ofc. caching , horizontal/vertical scaling solution.
when not use rest apis?
i don't think there such rule. can use rest on places use soa or request-response based messaging solution. don't think ideal fit event based messaging, technique has it's limitations. can make workaround polling or server sent events in such cases, or can create mixed interface uses both rest via http req-rep pat , (web)sockets event based part of application interface.
rest ideal choice in situations, when don't want spend money on writing different clients users or want interface client developers can use integrate system. e.g. public facebook api, can used fb app developers or private api of wholesaler, can used webshops of retailers automatically change prices or order products fill inventory.
by single html page web applications rest can prevent duplication of server side code on clients. e.g. building request templates (urls, forms, etc...) moved service (aka. hateoas constraint). client running in browser, can use general code build complete html page based on example json-ld response. not used currently.
Comments
Post a Comment