An intriguing coding challenge...

This is a discussion on An intriguing coding challenge... within the A Brief History of Cprogramming.com forums, part of the Community Boards category; In a recent article I read, the author of the article was asking why common business applications / website scripts ...

  1. #1
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416

    An intriguing coding challenge...

    In a recent article I read, the author of the article was asking why common business applications / website scripts do not effectively thread or spread the processing load over multiple cores / cpus.

    I figure, here is a good challenge to play with for the year, code in c or c++ a cgi script community website, that uses a database for it's back end. To make sure it uses threading or multiple cpus / cores, the db engine should be included in the code for the script, so connecting to an external engine such as mysql would defeat the purpose.

    Things to watch for in execution:
    cross site scripting exploits. // hint, absolute urls work better than relative in avoiding these.
    sql injection exploits

    Goals:
    Effective threading / cpu allocation
    complete community site, with news, blogs, searching, discussion forums. [ bnet.com or techrepublic.com as examples ]
    plugin framework for adding each section as modules
    api documentation for module development
    complete admin section to add and configure modules as well as domain specific settings.

    This is just my own personal project / self challenge for the year. I figure why not put it out so if it catches anyone else's interest they can have a project that isn't a quick bit of coding.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  2. #2
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    for what it's worth, I'm planning on actually putting the completed app online to test it for full functionality and security.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    This looks very misguided to me. Multi-threading any given task gives you a performance overhead. The smaller the tasks that you distribute over multiple CPUs, the higher the overhead.

    Server-side applications already make excellent use of multiple CPUs/cores. The granularity level is the request. Every request gets its own thread. Because requests ought to be mostly independent, the synchronization overhead is very low. Multi-threaded web servers like, well, every single one that is in production do a very good job at this stuff. Web application programmers would do a considerably worse job, given that
    1) they don't have the excellent request granularity,
    2) they don't have years and years of refining a single, relatively static goal (a web server), but instead write a multitude of different applications (the web apps), and
    3) on average, web application developers have considerably less experience with multi-threading issues than the guys working on the server.

    While this may give you performance gains on systems where there's never enough requests to get all cores busy, the approach doesn't scale. In high-traffic systems, the net performance would be worse. So basically, you get a performance gain on the systems that don't need it.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    I completely agree with Cornedbee, why parallelize web applications when the web server already executes each request in its own thread? There's nothing to gain here, unless there are very few requests and each request takes a very long time to process, which is very untypical for web applications.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  5. #5
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    I concur with Cornedbee. Ahmdal's law basically limits the performance you will get out of a web server.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  6. #6
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    Why anybody would want to make one of these in C or C++ is beyond me.
    There are 10 types of people in this world, those who cringed when reading the beginning of this sentence and those who salivated to how superior they are for understanding something as simple as binary.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 03-20-2009, 05:22 PM
  2. Coding Guideline ....!!
    By imfeelingfortun in forum Tech Board
    Replies: 8
    Last Post: 10-08-2006, 07:09 AM
  3. Requesting a challenge
    By RealityFusion in forum C++ Programming
    Replies: 8
    Last Post: 08-18-2003, 08:24 PM
  4. Coding Contest....
    By Koshare in forum A Brief History of Cprogramming.com
    Replies: 46
    Last Post: 10-14-2001, 04:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21