Singleton pattern, Suitable for multi-user websites ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • awebguynow

    #1

    Singleton pattern, Suitable for multi-user websites ?

    I come from a Java background and I was just wondering if a Singleton
    pattern is suitable for websites with heavy traffic.
    Of course the most common example given is the DB connection, and maybe
    a cache of connections, and a checkout/checkin strategy is more
    appropriate.

    Can use of a Singleton restrict resource usage and cause processing
    backlogs, such as deadlock ?

  • Iván Sánchez Ortega

    #2
    Re: Singleton pattern, Suitable for multi-user websites ?

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    awebguynow wrote:
    [color=blue]
    > I come from a Java background and I was just wondering if a Singleton
    > pattern is suitable for websites with heavy traffic.[/color]

    This is PHP. In PHP, every HTTP request is handled by a different thread, so
    there is no possibility of programming a singleton *all along* the
    different requests from the different users.

    - --
    - ----------------------------------
    Iván Sánchez Ortega -i-punto-sanchez--arroba-mirame-punto-net

    Un ordenador no es un televisor ni un microondas, es una herramienta
    compleja.
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.3 (GNU/Linux)

    iD8DBQFEUlL73jc Q2mg3Pc8RAqjeAJ 9Kap/uhQckaf4tBzrZH/8//gEytwCfQPk/
    9i7FYqP5FlD2fab Z8eX4jrw=
    =II99
    -----END PGP SIGNATURE-----

    Comment

    Working...