Share session between two forums.

Started by Delete this, February 21, 2013, 07:17:26 PM

Previous topic - Next topic

Delete this

I want to make a second forum and database to archive posts as my database is getting pretty big, (around 7gb now including custom index) but I want to make it as seamless as possible. I would like to share the session from one database to the other, so users don't have to log back in just to look at the archives. Copying the members from one to the other wouldn't be much of an issue, but I want to make sure nothing from the archives messes up the main forum session.

I plan to put the archives on another server, strictly for backups and archives, as the main host limits me to 10gb. What would be the best way to do this?

Arantor

Bridging two SMF forums is never easy. On multiple servers, it's *extremely* difficult because there's just no bridge architecture for that. Even if it were on the same server it'd be difficult and a bit of a mess.
Holder of controversial views, all of which my own.


Delete this

Well the forums would be on the same site. Its only the second(archive) database that would external, the forums would both be under the same domain. I don't really expect it to be easy either. But it doesn't look like it would be all that hard honestly, I mainly just need to know how to make the second forum only *read* the session key and not write it. From there I can handle the rest.

Arantor

Whether it's on the same site or not is actually irrelevant. The data would be on two different servers = virtually (though not entirely) unshareable!

You can't just put the data on a separate server, it really, really won't work and will break a lot of things unless you want to get into the realms of configuring clusters for MySQL (and SMF is totally untested on those!)

Which means the separate server needs to contain some or all of the code for SMF as well, which means sharing the session key - except the session data which it validates the key against is on a different server, of course.

This stuff is incredibly difficult, which is why no-one's pulled it off with any reliability for SMF.
Holder of controversial views, all of which my own.


Delete this

You are misunderstanding my intent here. At this point, I am not attempting to bridge the forums beyond a simple session cookie.  Ajax chat, and Joomla, and other smf extensions already do this, so I know the part I want is not unfeasible in any respect. Whether anything is broken in the second forum is irrelevant, it will not be used for a while yet and I ill have plenty of time to fix things as I go. Basically all I want is to share the login.

Arantor

Oh, I didn't misunderstand anything. It just doesn't work how you think it does.

AJAX Chat etc. (of which I have had the dubious honour of debugging in the past) piggybacks directly on the session, i.e. it lets SMF handle the session itself. Joomla, or more specifically jFusion, reuses the data because *it has the data already available ON THE SAME SERVER*.

You cannot simply share the login between two servers, it JUST DOESN'T WORK THAT WAY. No matter how simple you think it is, it really, really isn't.

The session key is a key, nothing more. It is a string of otherwise random numbers and letters that are checked against an existing list of current sessions. The master forum would be maintaining this at all times. The slave would have to be able to access this directly for it to work.

Heck, even IP.Connect, which is the nearest thing to what you're talking about (but for IPS) doesn't even share the credentials this way, but physically creates accounts and secondary cookies (and thus SEPARATE SESSIONS) on the slave.
Holder of controversial views, all of which my own.


Delete this

I don't see the problem then, the slave will be able to access that information. The forums themselves will both be under the same server, hence the session will be available to both. As long as the session name is the same, it would access the same data would it not?

Arantor

Quotethemselves will both be under the same server

That wasn't what you said to start with!

Quotehence the session will be available to both

Maybe, maybe not.

But even if you had them both in the same database on the same server, you'd STILL have to butcher the authentication system to point elsewhere because it's still not designed the way you want it to work.

It won't magically just work if you shove a session id at it. Even sharing the session table isn't enough between the two. You have to share or rewrite pretty much every query that uses the members table - and then just for fun if a member registers on one, that member won't be on the other because they'll either have separate tables.

It's a rabbit's nest. Quite honestly, you'd be simpler just either figuring out stuff you don't want to keep or getting a bigger server. The cost you'll pay (because no-one here will do it for free given that it will be unique to your setup) in implementation is probably higher than you'll pay in server fees.
Holder of controversial views, all of which my own.


Delete this

QuoteBut even if you had them both in the same database on the same server, you'd STILL have to butcher the authentication system to point elsewhere because it's still not designed the way you want it to work.
Yes I know.

QuoteIt's a rabbit's nest.
Its an experiment.

QuoteThe cost you'll pay (because no-one here will do it for free given that it will be unique to your setup) in implementation is probably higher than you'll pay in server fees.
It will cost nothing but my time. I don't expect anyone to do this for me or hold my hand. I just wanted to see what the experts had to say regarding this idea and see if I could get a few hints maybe at how this could be implemented.

Bottom line is, I know its going to be a time consuming project. Its not a standard setup and I understand I will have to change and remove parts here and there. That's the point, its something unique to challenge me, my knowledge of smf's inner workings and php. I enjoy that fact, otherwise I would find a simple solution and be done with it. Its a theory I want to test just as much as it would be useful in application.

Arantor

QuoteIt will cost nothing but my time. I don't expect anyone to do this for me or hold my hand. I just wanted to see what the experts had to say regarding this idea and see if I could get a few hints maybe at how this could be implemented.

The experts have said, and will say it again how much of a bad idea this is. Syncing two forums even on the same server requires serious reengineering of SMF which will also break all future upgrades just for a bonus.

You can search around here for where it was discussed before, but even the modest progress that was made had some serious side effects (and virtually no mods worked without modification on top)

While it's certainly an interesting theoretical project, the reality is that sharing it in the way you want to shouldn't really even be attempted. You'd make significantly better progress doing it with an IP.Connect-style bridge which isn't really a bridge. The two installations remain separate (and it even works across servers) but can reuse account details and implement SSO to a limited degree (it doesn't really do SSO, it uses the cookie, queries the primary to see if it is valid, and if so, then logs in a genuine user on the slave, so two sessions on the two sites - not what you wanted but infinitely more practical in the real world)
Holder of controversial views, all of which my own.


Delete this

I will definitely take a look at the IP.Connect bridge, this is the first I'm hearing of it. I was thinking of using the built in  SSI functions to share info like who is online between the two without actually duplicating all that much. As for registering new users, I as thinking of adding a bit of code that could either create two copies of each member and share them across the databases or more likely read *just* the member information tables of the main database without having any write access just to be safe.

Honestly I thought something like this would already exist. Archiving posts to a second database just seems like something that would already be done -somewhere- even if it wasn't practical for everyone.

Arantor

QuoteI will definitely take a look at the IP.Connect bridge, this is the first I'm hearing of it

It's for IPB. The main bridge file, ipsconnect.php should be publicly accessible from their site.

QuoteAs for registering new users, I as thinking of adding a bit of code that could either create two copies of each member and share them across the databases or more likely read *just* the member information tables of the main database without having any write access just to be safe.

Doesn't work like that.

QuoteHonestly I thought something like this would already exist. Archiving posts to a second database just seems like something that would already be done -somewhere- even if it wasn't practical for everyone.

And for the umpeenth time, there is a reason it doesn't already exist - because even the attempts that have been made (which are documented on this site) have major, major flaws and even then don't really do what you want.
Holder of controversial views, all of which my own.


Advertisement: