http://ciurana.eu/TSSJSE2009
http://ciurana.eu/contact
About Eugene...
import java.io.IOException;
import javax.servlet.http.*;
import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
if (user != null) {
resp.setContentType("text/plain");
resp.getWriter().println("Hello, " + user.getNickname());
} else {
resp.sendRedirect(
userService.createLoginURL(req.getRequestURI()));
}
}
}
Google Your
Applications Applications
Bigtable
Master Server
(Logical table management, load balancing, garbage collection)
FS 0 FS 1 FS 2 FS n
Using the Datastore
• Applications may access the Datastore using the JDO or the
JPA classes
• The JDO and JPA classes are abstracted using the
DataNucleus API
• Open source
• Not very popular
• Support for Java standards
• Poor documentation
• App developers may use either JDO or JPA directly from
their applications
• This is harder in practice because they are intended for relational data
modeling
• Direct access
• com.google.appengine.api.datastore
Using the Datastore
Limit Amount
que ry upd a te
Q ue ry?
F e tc h d a tum U pd a te
from d a tum in
M em cache d a ta b a se
d a tum is N o
Inva lid a te c a c h e
N one
Yes
Q ue ry A d d or upd a te
d a tum from d a tum to
d a ta b a se M em cache
A d d d a tum to
M em cache
U se d a tum
in a pp
B e g in
Overcoming Quota Blues
Keys and values may be
anything if they are
Cache cache;
serializable
try {
cache = CacheManager.getInstance()
.getCacheFactory()
.createCache(Collections.emptyMap());
} catch (CacheException e) {
// ...
}
Parameterized types OK
Scheduling Tasks
• The original versions of App Engine (Python) only supported
on-line, interactive web apps or callbacks
• A cron service was introduced for both Java and Python
• “cron” is used as a generic term; it’s not a UNIX cron
• Jobs are configured via WEB-INF/cron.xml
• The file is similar to Apple’s launchd configuration files
• Jobs run in UTC unless a locale is specified
• The schedules are defined in English-like keywords
• Jobs become active when they are uploaded
• A job is active until an empty entry or even an empty cron.xml file is re-
uploaded
Scheduling Tasks
http://ciurana.eu/scalablesystems
Questions?
Eugene Ciurana
Open source evangelist
tssjs@ciurana.eu
+41 44 586 8462