DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
11 Monitoring and Observability Tools for 2023
Learn more
  1. DZone
  2. Data Engineering
  3. Databases
  4. PHP Sessions on Steroids

PHP Sessions on Steroids

John Esposito user avatar by
John Esposito
·
Nov. 17, 11 · Interview
Like (0)
Save
Tweet
Share
5.35K Views

Join the DZone community and get the full member experience.

Join For Free
  • Hello.
  • Hello.
  • I am looking for the broccoli.
  • It's over there.
  • Hello.
  • Hello.
  • I am looking for the spinach.
  • It's next to the broccoli.
  • What's broccoli?


If conversations went like this, everybody would hate their lives. (It's also profoundly opposed to how real conversations go.)

Roughly speaking, however, this is how HTTP (or any other request-response protocol) interactions progress. Which is fine for simple actions (authentication, for instance: just say swordfish and you're in), but not for real life, and therefore not for anything like (a) the web is now, or (b) where the web is going. This is why sessions are so important -- why two-way sessions are now being built into new web standards, for example.

But sessions introduce some real technical problems -- especially when scaled. Sessions are ongoing conversations -- but if the service interlocutor is really just one physical machine, and that one physical machine just happens to be talking to bunches of people at once..or if one server just happens to be having some really intense conversations, say, with a particularly important client..then service will be slow, and unnecessarily so.

To the rescue comes Johannes Schlüter, who proposes:

A nice solution for this would be to store the sessions in a central repository which can be accessed from all web servers.


True; and Johannes already showed how to use MySQL 5.6's memecached API to speed data access from all servers (a post in itself well worth reading).

But for a more scalable, more fundamentally distributed solution, check out his new post on using the MySQL Cluster for PHP session storage. Here's his idea, in a nutshell:

We need MySQL Cluster and an API node. Now instead of building a C++ module specific for that but why built such a specific solution when a more generic one exists? - The mentioned Development Milestone release of MySQL Cluster 7.2 includes a new form of API node: memcached.

And he goes on to explain how and why to use memecached (rather than memecache with no d) for exactly this purpose.

Very practical, very well-explained post. Read it and make your PHP sessions fly like the wind.

PHP Session (web analytics) MySQL Cluster

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Java Code Review Solution
  • Important Data Structures and Algorithms for Data Engineers
  • Understanding and Solving the AWS Lambda Cold Start Problem
  • Java REST API Frameworks

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: