开发者

Web Application with Sample "guest" data

we are currently working on a new web application using Java and MySql. We would like to implement a "guest" login feature. The idea is simple: anyone can login as a guest user and get access t开发者_开发问答o a small pre-defined dataset which they can then interact with as if they were fully paid up clients.

This feature should have these attributes:

  • Allow multiple concurrent guest logins without cross-talk
  • When the guest session closes any changes will be lost
  • The guest login should not be too slow

Here are a few ideas that we have come up with, although each has it Pros and Cons:

1. Treat them as any other client and store them in the MySql database.

PROS

  • Easier to implement
  • No sublte differences can occur

CONS

  • Polutes the live database with sample data
  • Problem of "initial state" not solved
  • Clean-up is not automatic

2. Use an In-memory temporary database solution

PROS

  • No cross-talk
  • Initial state can be loaded as an image?
  • Clean up is trivial

CONS

  • The In-memory database and MySql might not support the same features or differently
  • There may be scaling issues

My question is: what would be the best way to achieve this? Is there a best-practive for this type of thing?

Thanks in advance,

Steve.


i'd go with option 3 ... using a separate schema or database with the same structure/infrastructure as your live database.

PROS

  • Easier to implement
  • No sublte differences can occur
  • Doesn't polute the live database with sample data
  • The MySql will support the same features
  • There won't be scaling issues

CONS/things you'll still need to solve:

  • Initial state - and i'd suggest a simple script/routine to pre-populate as needed
  • Clean-up is not automatic - and again a simple script/routine at end of session


Normally when you have a guest based system providing sample data, you don't point to the live database for these users - you point them to a special guest version. There are many reasons for this, but the main one is that you can roll the database back to a checkpoint of the sample data without affecting the live users.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜