I am making my first app on google app engine. Before i was just checking the correct results for my app. But then my app started responding really late. Then i went through google app engine docs and now started using appstats. I am really new to that. I watched a video about it and got some stuff but still i am little bit confused. Following is the graph for one login request in my app:
and here following is the code for my LoginCheckServlet:
public class LoginCheckServlet extends HttpServlet {
@SuppressWarnings("unchecked")
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
HttpSession session = req.getSession(true);
PersistenceManager pm = PMF.get().getPersistenceManager();
try
{
List<User> result = null;
Query query = pm.newQuery(User.class);
query.setFilter("email == emailParam");
query.declareParameters("String emailParam");
result = (List<User>) query.execute(req.getParameter("email"));
if(result.size() == 0){
out.println(0);
}else{
String pwd = req.getParameter("password");
String userPwd = result.get(0).getPassword();
if(pwd.equals(userPwd)){
result.get(0).setActive(true);
session.setAttribute("email", result.get(0).getEmail());
session.setAttribute("name", result.get(0).getName());
out.println("1");
}else{
out.println("2");
}
}
}catch(Exception ex)
{
out.println(ex);
}
finally
{
pm.close();
}
}
}
according to google app engine a query takes most of the time and it is around 50-100 ms. But in graph total time taken is 15167 ms. And the time in which my app is doing nothing (template expansion) called by the guy in presentation is almost 140000ms. I do not understand that what is that template expansion and why my app is taking a big amount of that? How can i reduce it? May be its a basic question but i am very new to this and i searched but could not find something helping. Thanks in advance.