?

Log in

No account? Create an account

From the Solution Pool this evening...

« previous entry | next entry »
Dec. 21st, 2007 | 01:16 am

The user has session data in memcached. It is set to expire after X period of time.

How do you update the database to know when the expiration happened?

Poll for the data.

When you create the session data add a "session_active" field to the account. If you create a session for the user set this to "on", otherwise default it to off.

Now insert the data into memcached and set an expire on it. Each time you fetch the data, touch it to last a bit longer.

How do you turn off the enum "session_active" in MySQL?

Write an Event in 5.1 and probe Memcached via UDF to find out if the data still exists. If it does not, update the field. Just select each row that showed an active session and check it.

I got asked this in IRC and had to think about the logic of this. I am not sure I would design a need into knowing if a session variable still existed or not, but it is good to know that it is possible. You could take this one step further and write a trigger on the user account, and update any session information based on a change to the user's account.

What might be nifty? If I came up with a generic way to group sets of commands into one packet. This would help with performance whenever you do this type of actions.

Link | Leave a comment | Share

Comments {13}

Tanjent

unrelated

from: tanjent
date: Dec. 21st, 2007 09:20 am (UTC)
Link

I'm starting to write effects for the spherical projector now. Here's the first nice-looking one I've come up with -

http://blip.tv/file/554403

Reply | Thread

Kytty

(no subject)

from: kytty
date: Dec. 21st, 2007 03:21 pm (UTC)
Link

Oh Goody! My new unit is about databases and database management...there was only a one-line mention of mySQL in the text though. How does mySQL compare to ACESS and ORACLE? (which I understand are at opposite ranges in regards to the complexity and amount of data they can manage.)

Reply | Thread

Kytty

(no subject)

from: kytty
date: Dec. 21st, 2007 03:23 pm (UTC)
Link

Oh, and feel free to add anything you feel entry-level students should know about mySQL because I may post it to the unit discussion board...you know, for educational purposes :)

Reply | Parent | Thread

Brian "Krow" Aker

(no subject)

from: krow
date: Dec. 21st, 2007 06:06 pm (UTC)
Link

Its like comparing a goldfish to a sperm whale, while they both swim, that is about where their similarities end.

Reply | Parent | Thread

Kytty

(no subject)

from: kytty
date: Dec. 21st, 2007 08:02 pm (UTC)
Link

Would you like to take the opportunity to educate some students about mySQL?

Reply | Parent | Thread

Brian "Krow" Aker

(no subject)

from: krow
date: Dec. 21st, 2007 10:27 pm (UTC)
Link

Where is this at?

Reply | Parent | Thread

Kytty

(no subject)

from: kytty
date: Dec. 22nd, 2007 12:43 am (UTC)
Link

It's an online program at Kaplan University. Our text had one teeny line about mySQL so that if you'd like to offer some insight into mySQL, I would post it on the class bulletin board for others to see.

Reply | Parent | Thread

Brian "Krow" Aker

(no subject)

from: krow
date: Dec. 22nd, 2007 01:00 am (UTC)
Link

That in Seattle, or?

Reply | Parent | Thread

Kytty

(no subject)

from: kytty
date: Dec. 22nd, 2007 01:15 am (UTC)
Link

Well, it's based in Iowa but has offices in FL and probably elsewhere.

http://www.kaplan.edu/ku/aboutku/default.aspx?ID=About&loc=0

Reply | Parent | Thread

Kytty

(no subject)

from: kytty
date: Dec. 22nd, 2007 01:19 am (UTC)
Link

Here's my program:

http://www.kaplan.edu/KU/schools/it/bsit/curriculum/default.aspx?Link=Curriculum&ProgramId=33312&MainTab=Program&loc=0

I'm taking Introd to IT 2

Reply | Parent | Thread

(no subject)

from: jamesd
date: Dec. 22nd, 2007 07:33 am (UTC)
Link

MySQL can store huge amounts of data, many terrabytes. It depends on what's being done with it. Wikipedia, Google's ads system and LiveJournal are among the places that use MySQL with lots of data and very high loads. Google tried switching to a major proprietary database for their ads system and gave up because it performed worse than MySQL for their application. Try MySQL when Access isn't good enough or you need something that'll run on lots of different operating systems, before you try Oracle. In the unlikely event that MySQL can't handle it, ask a MySQL expert for help, then maybe consider something else if the expert says that the problem is one MySQL isn't really suitable for rather than saying how to do it.

Lesson 1: MySQL is the correct typing of the name, not mySQL. :)
Lesson 2: normal pronunciation is My S Q L rather than My sequel.

Reply | Parent | Thread

Kytty

(no subject)

from: kytty
date: Dec. 23rd, 2007 02:45 am (UTC)
Link

Thanks for the info and the spelling correction!

Reply | Parent | Thread

(no subject)

from: jamesd
date: Dec. 22nd, 2007 07:36 am (UTC)
Link

This session expiration problem cries out for an on expiration notification handler in memcached rather than a hack in MySQL. Your approach still offloads lots of work to mmecached but I don't really want database-driven solutions if I'm using memcached to offload the database server. I want memcached to say touch the database only when that's necessary.

Grouping operations would indeed be nifty and ensure enduring love from network people. :)

Reply | Thread