SitePoint Sponsor

User Tag List

Page 2 of 6 FirstFirst 123456 LastLast
Results 26 to 50 of 133
  1. #26
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's one little secret I should confess to. I used mysql_unbuffered_query() (which more people should use, depending on the problem).

    The same done with mysql_query looks like this - http://www.pinkgoblin.com/test/speedtest_buffered.php

    The final code (replace your mysql_query(_unbuffered) as you choose);

    PHP Code:
    <?php
    class SpeedTest {
        var 
    $db;    // Database resource
        
    var $query// Query resource
        
    var $start// Start time
        
    function SpeedTest () {
            
    $this->start=$this->getmicrotime();
            
    $this->db=mysql_pconnect('localhost','user','pass'); // Enter correct values here
            
    mysql_select_db('dbname',$this->db); // Enter correct dbname here
        
    }
        function 
    getmicrotime(){ 
            list(
    $usec$sec) = explode(" ",microtime()); 
            return ((float)
    $usec + (float)$sec); 
        }
        function 
    fetch() {
            
    $this->query=mysql_query('SELECT * FROM products',$this->db); // Perform query here
        
    }
        function 
    getTime() {
            return (
    $this->getmicrotime()-$this->start);
        }
        function 
    getRow () {
            if ( 
    $row=mysql_fetch_array($this->query,MYSQL_ASSOC) )
                return 
    $row;
            else
                return 
    false;
        }
    }
    $sTest=new SpeedTest;
    ?>
    <html>
    <head>
    <title>PHP Speed Test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="blah.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <?php
    $sTest
    ->fetch();
    ?>
    <p><b>Query Took: <?php print ($sTest->getTime()); ?></b></p>

      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr class="box1">
          <td>productID</td>
          <td>productName</td>
          <td>supplierID</td>
          <td>categoryID</td>
          <td>quantityPerUnit</td>
          <td>unitPrice</td>
          <td>unitsInStock</td>
          <td>unitsOnOrder</td>
          <td>reorderLevel</td>
          <td>discontinued</td>
        </tr>
    <?php
    while ( $row=$sTest->getRow() ) {
    ?>
      <tr>
          <td><?php print ( $row['PRODUCTID']); ?></td>
          <td><?php print ( $row['PRODUCTNAME']); ?></td>
          <td><?php print ( $row['SUPPLIERID']); ?></td>
          <td><?php print ( $row['CATEGORYID']); ?></td>
          <td><?php print ( $row['QUANTITYPERUNIT']); ?></td>
          <td><?php print ( $row['UNITPRICE']); ?></td>
          <td><?php print ( $row['UNITSINSTOCK']); ?></td>
          <td><?php print ( $row['UNITSONORDER']); ?></td>
          <td><?php print ( $row['REORDERLEVEL']); ?></td>
          <td><?php print ( $row['DISCONTINUED']); ?></td>
      </tr>
    <?php
    }
    ?>
    <p><b>Page Took: <?php print ( $sTest->getTime() ); ?></b></p>
    </table>
    </body>
    </html>
    I've moved out the CSS now to make it easier to read.

    One thing I'd like to see D add is another of these;

    Code:
    <ASP:Label id="endLoadTime" runat="server" Text="Loading..."></ASP:Label>
    ...which is placed at the end of the page after the table building is done.

    Better yet would be placing VB directly at the bottom, if possible, to guarantee it gets executed at the very last: I'm not convinced by the trace output.

    If anyone wants to try an ASP.NET to MySQL, recommend using one of these http://www.mysql.com/downloads/api-dotnet.html not ODBC.

  2. #27
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Since we're pointing stuff out, D's example could have been a lot faster. We knocked that around in the .NET forum as well and so on. I could theoretically install .NET, ASP and MySQL all on the same server here and run them with no other load if you guys want as that may be a better judge.

    Even then it wouldn't be perfect (PHP has better optimization for MySQL than .NET does) but it would be a far better picture and closer to where we want to be, I think anyways.

    We won't ever get truly perfect (different coding techniques) but it is interesting to watch
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  3. #28
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice results on the PHP

    Ahhh, distrust from Harry!

    As .NET is event driven, its not possible to spread the code around that page (bah, speghetti code!!).

    The trace code is accurate Harry, atleast it better be cos I use it for debugging...

    I can access the End Render event and running a function at the same time.

    What does the mysql_unbuffered_query do exactly?

    As it WASN'T a performance test, I'm curious, can you optimise that code you have any more? Without accessing the server to install anything? How long did that code take to write?


  4. #29
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Jeremy W.
    Since we're pointing stuff out, D's example could have been a lot faster. We knocked that around in the .NET forum as well and so on. I could theoretically install .NET, ASP and MySQL all on the same server here and run them with no other load if you guys want as that may be a better judge.

    Even then it wouldn't be perfect (PHP has better optimization for MySQL than .NET does) but it would be a far better picture and closer to where we want to be, I think anyways.

    We won't ever get truly perfect (different coding techniques) but it is interesting to watch
    Hey, please do this! If nothing else, it'd give us an interesting comparison between mySQL and MSSQL.
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  5. #30
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    J, want me to write the code?

    If so, we going for speed?

  6. #31
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Well, if I'm going to do it there are a few things. First, all the code really should be optimized as much as possible. Second we need to decide on a database.

    Personally I'm not convinced on MySQL because I've never seen .NET access it, and I know that ASP is piss slow at accessing it.

    How's PHP's connect to SQL Server? Could we not just use that?

    Let me know what you guys think. It still doesn't solve all the issues, but certainly does get us closer to a baseline, and I'm open for suggestions on better ways (concurrent connections, etc?) to have a curious look around.

    It's good to see the different languages, because it's obvious what some of the strengths are just looking at the code
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  7. #32
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by dhtmlgod
    J, want me to write the code?

    If so, we going for speed?
    For .NET or ASP?

    I think we should go for raw speed, but keep it all in the languages (unless we do a stored proc for all... that'd be interesting as well actually, see if there was actually a difference...)...

    What does everyone else think, it's not like I'm running this, and I really don't want it to become some kind of official guage either, just a curiousity really
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  8. #33
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Languages with .NET is a mute point, and I really don't want to write any ASP!

    I think we should try .NET with MySQL, I've always wanted to.


  9. #34
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    2 secs...

  10. #35
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If we do .NET with MySQL, I'd like to do both with SQL Server as well. I dont' konw the quality of the drivers for each, so it's only fair to run the tests in both environments, at least in my opinion.
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  11. #36
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sounds good to me. If we want to test ASP, we should maybe see if M@cro is intested...


  12. #37
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Personally I would like to see a few rounds of tests with all code optimized internally, not so much for the db:

    MySQL-based test
    SQL Server "pure" test
    SQL Server w/ stored proc test

    And I'd love to do:

    Connections limit
    Connections vs speed tests (curve)
    Server load vs connections (curve)

    ... dunno, what else?

    J
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  13. #38
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by dhtmlgod
    Sounds good to me. If we want to test ASP, we should maybe see if M@cro is intested...

    You mean M@arco?
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  14. #39
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol

    Sounds good Jeremy... downloading mySQL right now.

  15. #40
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this sounds interesting

  16. #41
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP with MS Sql shouldn't be a problem.

    What is a problem, from where I'm standing, is PHP runs alot slower on Windows (sorry but having read the J2EE vs .NET already know about what happens when you try to beat MS on their home turf ).

    Just been talking to D about it - what we need is either a machine which dual boots to Windows / Linux or two machines of the exact same spec running side by side, one Windows / .NET, the other Linux / PHP (perhaps with a trial version of Zend Accelerator installed for a second round of tests, just to see how it does).

    I haven't got anything I can easily do that with (these days I do everything I can to avoid installing OSes).

    Any ideas?

    Otherwise, when testing how long a script takes to run, I don't think we should rely on the languages themselves to provide that info - instead use a "remote" (actually running on the same server so no network delay) HTTP client script which measures the time between sending the request for the page and receiving the end of the page.

  17. #42
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm about to reinstall my OS, and I'm sure my machine wouldn't mind handling two OSes.



    Its a p4 2.53ghz, with 256meg and a 40gig hardrive...

    I know what OS we would use for the .NET, but if someone points me to the right linux and is on the end of a phone when I install it...


  18. #43
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I can't dual boot the servers, that would definitely be overstepping my bounds *L*

    I'd be interested to see the Zend accelerator as well, and watch load at page access and stuff. It's too bad you can't insert breaks into webpages because it would be interesting to see how it breaks down as stuff happens

    So, hardware chosen: D's computer.

    D, you're gonna use win2k right, not XP? There've been a rash of problems lately with XP and .NET, most of which MS is releasing patches for but still, win2k is solid.

    Thing is that on different OS's it isn't so much about the language then. I'd prefer to run a second series of tests with PHP on Linux than take it off the Windows tests entirely. After all, it is supposed to run equally well on all OS's right (dig at the guys who said IE and .NET running well together was bad )
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  19. #44
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ahhh... no, I was actually going for .NET Server... (mainly cos I've had RC1 for ages without a chance to install it)

  20. #45
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    hmm, be an interesting "alter ego" test, just like running PHP on Linux because it's the "home environment"...

    Well, our tests are rapidly expanding and we will likely need to limit scope a little for these to be at all useful, so how about 2 rounds of tests at 2 different times?

    On Windows:

    MySQL-based test
    SQL Server "pure" test
    SQL Server w/ stored proc test
    Connections limit
    Connections vs speed tests (curve)
    Server load vs connections (curve)

    On "Home OS":

    MySQL-based test
    SQL Server "pure" test
    SQL Server w/ stored proc test
    Connections limit
    Connections vs speed tests (curve)
    Server load vs connections (curve)

    And then do a straight up PHP speed test on .NET Server, just to see if it decreases performance? This way I could do the Windows tests this week, and it would give D a chance to setup the "Home OS" test system, thoughts?
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  21. #46
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's gonna be one hell of a phone bill

    Suse is probably the easiest to install. Somewhere on their site you can download it for free but installation isn't so nice.

    As to dual booting, think the options are either install Linux first - it allows dual booting with LILO. Alternatively use partition magic to build to partitions. The problem with Windows is if you install it first with NTFS you can't later adjust the partitions without a format.

    Personally I be intested in knowing if there's host that would sponsor this (for some advertising) that does .NET and PHP hosting on machines of the same spec.

    Otherwise I'll be able to do something after Christmas - we get new machines at work.

  22. #47
    SitePoint Wizard Mincer's Avatar
    Join Date
    Mar 2001
    Location
    London | UK
    Posts
    1,140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Jeremy W.
    And then do a straight up PHP speed test on .NET Server, just to see if it decreases performance? This way I could do the Windows tests this week, and it would give D a chance to setup the "Home OS" test system, thoughts?
    It would be interesting to do a test with php running on Win32 under IIS, Apache, and Apache 2. If you can't do that Jeremy, I could run it. Although I'm away this weekend, so it would be next week.

  23. #48
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One other thing;

    It's too bad you can't insert breaks into webpages because it would be interesting to see how it breaks down as stuff happens
    There is a way to do that with PHP and no doubt .NET by using page caching (called output buffering in PHP's case) in "chunks" - you assign the current cache to a variable, store in on the filesystem, with a timestamp perhaps, flush the cache and do the next bit. You can then go back and examine each one later.

  24. #49
    SitePoint Wizard Mincer's Avatar
    Join Date
    Mar 2001
    Location
    London | UK
    Posts
    1,140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by HarryF
    Suse is probably the easiest to install. Somewhere on their site you can download it for free but installation isn't so nice.
    I've recently been trying RedHat 8 and Mandrake 9. Both are a doddle to install. I think that all the packages should be compiled properly though. No RPM installs.

    Anyone good with BSD?

  25. #50
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, one of the hosts I use offers .NET hosting with PHP support, but they don't have mySQL

    J, how would we test server loads/connections/etc. I know theres software out there, but aren't they pricy?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •