简体   繁体   中英

AppEngine, REST, and Server Requests

I've recently taken over a project that involves and iOS app connecting to a Restful web service for sending and retrieving data, and I find myself struggling with Server performance.

Since it's RESTful, the different kinds of data can be accessed from different URI endpoints. When a user logs into the app for the first time (ignore the registration piece), the client must download all data for that user. Since the data resides at different endpoints, the client makes a request to each, resulting in many requests to the same server to acquire all the data.

My Question... is this a sound architecture? The server ends up processing many requests just to get data for a single user. Wouldn't it be more prudent to have a single request that returns all the user's data? The server is appengine, and I'm trying to be more efficient in the use of it's free quotas.

Thanks for any insights in advance!

Hard to answer without knowing how your data is structured.

If you're re-querying the same entities over those 6-7 requests, it's a bad idea. If you're querying different entities, you won't really have a significant difference in combining it into one query.

Having multiple requests can also allow your UI to "feel" more responsive as the user sees the page updating as results come in. With a single request, the user will be simply waiting until the entire request completes.

It sounds like whoever created the project initially decided to go with the cleanliness of the REST API by separating requests for different types of objects. If you want to unify all user-related objects into one request, it's probably a much "messier" architecture.

While there is indeed some overhead to having multiple requests, it generally isn't that big a deal.

There is a request time limit of 60 seconds. Depending on the work that needs to be done for the single "return-all-user-data" request, this might play a role.

Check the Google App Engine doc:
https://developers.google.com/appengine/docs/java/runtime#The_Request_Timer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM