Servlet performance speed

Any advice on how to improve the performance and speed
of this servlet or any other comments please
public class LogInServlet extends HttpServlet {
    byte[] header;
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
        // variables
        ServletOutputStream out;
        Calendar c;
        String day;
        String date;
        String timenow;
        Connection con = null;
        Statement stmt = null;
        ResultSet result = null;
        // setup output
        response.setContentType("text/html");
        out = response.getOutputStream();
        // get inputs
        String pass = (String)request.getParameter("*");
        String namenum = (String)request.getParameter("*")+
        ", "+
        (String)request.getParameter("*")+
        " ("+
        (String)request.getParameter("*")+
        // get current time
        c = Calendar.getInstance();
        try{
            // get db connection
            Context initCtx = new InitialContext();
            Context envCtx = (Context) initCtx.lookup("java:comp/env");
            DataSource ds = (DataSource)envCtx.lookup("jdbc/*");
            con = ds.getConnection();
            stmt = con.createStatement();
            result = stmt.executeQuery("*");
            // check username
            if(result.next()){
                // check password
                if(result.getString("*").equals(pass)){
                    // SOLVES LOWERCASE PROBLEM
                    namenum = result.getString("*");
                    day = getDay(c);
                    date = getDate(c);
                    stmt.close();
                    stmt = null;
                    stmt = con.createStatement();
                    result.close();
                    result = null;
                    result = stmt.executeQuery("*");
                    // check if setup to login
                    if(result.next()){
                        // check if logged in already
                        if(!date.equals(result.getString("*"))){
                            stmt.close();
                            stmt = null;
                            stmt = con.createStatement();
                            result.close();
                            result = null;
                            result = stmt.executeQuery("*");
                            result.next();
                            String time = result.getString(day+"_start");
                            timenow = getTime(c);
                            // check if late
                            if(checkIfLate(c,time)){
                                stmt.close();
                                stmt = null;
                                stmt = con.createStatement();
                                result.close();
                                result = null;
                                result = stmt.executeQuery("*");
                                // check if timeoff booked
                                if(!result.next()){
                                    // add late record
                                    stmt.close();
                                    stmt = null;
                                    stmt = con.createStatement();
                                    stmt.executeUpdate("*");
                                    // update login
                                    stmt.close();
                                    stmt = null;
                                    stmt = con.createStatement();
                                    stmt.executeUpdate("*");
                                    // complience
                                    stmt.close();
                                    stmt = null;
                                    stmt = con.createStatement();
                                    stmt.executeUpdate("*");
                                    // late
                                    out.write(header);
                                    out.print("</body></html>");
                                    out.close();
                                else{
                                    // update login
                                    stmt.close();
                                    stmt = null;
                                    stmt = con.createStatement();
                                    stmt.executeUpdate("*");
                                    // complience
                                    stmt.close();
                                    stmt = null;
                                    stmt = con.createStatement();
                                    stmt.executeUpdate("*");
                                    // ok
                                    out.write(header);
                                    out.println("</body></html>");
                                    out.close();
                            else{
                                // update loging
                                stmt.close();
                                stmt = null;
                                stmt = con.createStatement();
                                stmt.executeUpdate("*");
                                // complience
                                stmt.close();
                                stmt = null;
                                stmt = con.createStatement();
                                stmt.executeUpdate("*");
                                // ok
                                out.write(header);
                                out.println("</body></html>");
                                out.close();
                        else{
                            out.write(header);
                            // alreadyLoggedIn
                            out.println("</body></html>");
                            out.close();
                    else{
                        out.write(header);
                        // notSetupLogin
                        out.println("</body></html>");
                        out.close();
                else{
                    out.write(header);
                    // passwordIncorrect
                    out.println("</body></html>");
                    out.close();
            else{
                out.write(header);
                // nameIncorrect
                out.println("</body></html>");
                out.close();
        catch(Exception e){
            out.write(header);
            out.println("</body></html>");
            out.close();
        finally{
            if(result != null){
                try{
                    result.close();
                catch(SQLException e){
                result = null;
            if(stmt != null){
                try{
                    stmt.close();
                catch(SQLException e){
                stmt = null;
            if(con != null){
                try{
                    con.close();
                catch(SQLException e){
                con = null;
    private boolean checkIfLate(Calendar c,String t){
        StringTokenizer stz = new StringTokenizer(t,":");
        int sh = Integer.parseInt(stz.nextToken());
        int sm = Integer.parseInt(stz.nextToken());
        int ch = c.get(Calendar.HOUR_OF_DAY);
        int cm = c.get(Calendar.MINUTE);
        if(ch > sh)
            return true;
        else if(ch == sh){
            if(cm > sm)
                return true;
            else
                return false;
        else
            return false;
    private String getTime(Calendar c){
        int t = c.get(Calendar.MINUTE);
        if(t < 10)
            return c.get(Calendar.HOUR_OF_DAY)+":0"+t;
        else
            return c.get(Calendar.HOUR_OF_DAY)+":"+t;
    private String getFullDay(String d){
        if("mon".equals(d))
            return "Monday";
        else if("tue".equals(d))
            return "Tuesday";
        else if("wed".equals(d))
            return "Wednesday";
        else if("thu".equals(d))
            return "Thursday";
        else if("fri".equals(d))
            return "Friday";
        else
            return "Sunday";
    private String getDay(Calendar c){
        int d1 = c.get(Calendar.DAY_OF_WEEK);
        if(d1 == 2)
            return "mon";
        else if(d1 == 3)
            return "tue";
        else if(d1 == 4)
            return "wed";
        else if(d1 == 5)
            return "thu";
        else if(d1 == 6)
            return "fri";
        else
            return "z";
    private String getDate(Calendar c){
        int dateI1 = c.get(Calendar.MONTH)+1;
        int dateI2 = c.get(Calendar.DAY_OF_MONTH);
        if(dateI1 < 10){
            if(dateI2 < 10)
                return Integer.toString(c.get(Calendar.YEAR))+
                "-"+
                "0"+
                Integer.toString(dateI1)+
                "-"+
                "0"+
                Integer.toString(dateI2);
            else
                return Integer.toString(c.get(Calendar.YEAR))+
                "-"+
                "0"+
                Integer.toString(dateI1)+
                "-"+
                Integer.toString(dateI2);
        else{
            if(dateI2 < 10)
                return Integer.toString(c.get(Calendar.YEAR))+
                "-"+
                Integer.toString(dateI1)+
                "-"+
                "0"+
                Integer.toString(dateI2);
            else
                return Integer.toString(c.get(Calendar.YEAR))+
                "-"+
                Integer.toString(dateI1)+
                "-"+
                Integer.toString(dateI2);
    protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException {
        processRequest(request, response);
    protected void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException {
        processRequest(request, response);
    public String getServletInfo() {
        return "Short description";
    public void destroy() {
    public void init(ServletConfig config) throws ServletException {
        super.init(config);
        header = "<HTML><HEAD><TITLE>*".getBytes();
}

DrClap / AnyOne
The problem I'm having is that everybody uses this servlet at around the
same time and this causes the memory usage and cycles to spike and
halts other application running on the server.
I was hoping that by speeding up the application,so that people could get
in and out of the servlet quickly this would reduce the memory usage
as some people would finish before the next people use it.
I also wanted to decrease the amount of memory the servlet uses.
The garbage collection and tomcat are tuned.
I want to optimise the code so that I can restrict the JVM to use the
least amount of memory.
I'm assured the query strings and index's are optimised.
The code snippet above yielded a 30% increase in execution time
(this was using a loadtester and thousands of requests on just that piece of code)
I'm going to give preparedstatements a try to see if it changes speed
(the data is cleaned using javascript on the clientside)
Questions / Comments
Connection Pooling:
Not if you used a connection pool, which you should be doing anyway. And if you're putting all your code >>in one giant class just to avoid creating an object, you're doing the wrong thing.That is exactly why I put the code in the one servlet.
If I set the max connections number to the maximum number of users
and by putting all the code in one servlet each user will use only one connection:
1. therefore there will be no one waiting for a connection to become available (increases speed)
2. the less connections created the less memory used
Is this thinking correct?????
Servlet HTML vs JSP
I know it is correct design to keep the view away from business logic
but
1. Is it quicker and less memory hungry to use ServletOutputStream to print html
or requestDispatcher to jsp?????
}

Similar Messages

  • Servlet performance

    Dear All,
    Could you explain me the follow statistic:
    The time to get complete created by servlet page - 15 s
    The time of servlet work (database access and HTML layout) - 70%
    The time of database processing (inside servlet work for sure) - 3%
    The network speed - 100Mbit
    When we try to copy dynamically generated page on Server as a file it
    appears immideatly.
    So it seems that the problem with data output from a servlet.
    What do you think, dear ALL? How can I manage it and fix?
    With regards, Alexey Ionin.

    From your statistic, database access and HTML layout are 70%. In most cases,
    database is the bottlenectk. Try to tune up your database to boost up
    performance.
    Cheers - Wei
    Alexey Ionin <[email protected]> wrote in message
    news:[email protected]..
    Dear All,
    Could you explain me the follow statistic:
    The time to get complete created by servlet page - 15 s
    The time of servlet work (database access and HTML layout) - 70%
    The time of database processing (inside servlet work for sure) - 3%
    The network speed - 100Mbit
    When we try to copy dynamically generated page on Server as a file it
    appears immideatly.
    So it seems that the problem with data output from a servlet.
    What do you think, dear ALL? How can I manage it and fix?
    With regards, Alexey Ionin.

  • Servlet performance.  File or Db access?

    Does anyone know which would be a faster method to access snippets of html code? Either open up a file and println it or grab the snippet from a database table? Also, where can I find a good tool to test the speed and performance of my servlets?

    Does anyone know which would be a faster method to
    access snippets of html code? Either open up a file
    and println it or grab the snippet from a database
    table? This heavely depends on what you do how many times and if you are caching or not. For snipplets i would think of putting it into a file and adding the file using ssi or RequestDispatcher.include() or jsp:include. Seems to be the easiest way to do.
    Also, where can I find a good tool to test the
    speed and performance of my servlets? jakarta.apache.org
    Don't know the name at the moment, but they have a project that's purpose is to simulate clients to test performance. I never used it (since for most web apps performace is not a problem) but i read a lot about it and it seems to be very flexible to simulate entire sessions, not just sending simple requests over and over again.

  • How to increase performance speed of Photoshop CS6 v13.0.6 with trasformations in LARGE image files (25,000 X 50,000 pixels) on IMac3.4 GHz Intel Core i7, 16 GB memory, Mac OS 10.7.5?   Should I purchase a MacPro?

    I have hundreds of these large image files to process.  I frequently use SKEW, WARP, IMAGE ROTATION features in Photoshop.  I process the files ONE AT A TIME and have only Photoshop running on my IMac.  Most of the time I am watching SLOW progress bars to complete the transformations.
    I have allocated as much memory as I have (about 14GB) exclusively to Photoshop using the performance preferences panel.  Does anyone have a trick for speeding up the processing of these files--or is my only solution to buy a faster Mac--like the new Mac Pro?

    I have hundreds of these large image files to process.  I frequently use SKEW, WARP, IMAGE ROTATION features in Photoshop.  I process the files ONE AT A TIME and have only Photoshop running on my IMac.  Most of the time I am watching SLOW progress bars to complete the transformations.
    I have allocated as much memory as I have (about 14GB) exclusively to Photoshop using the performance preferences panel.  Does anyone have a trick for speeding up the processing of these files--or is my only solution to buy a faster Mac--like the new Mac Pro?

  • Webstart to Servlet Performance Issues

    Hi. I have a application that connects to a servlet to do database operations on a server. When it runs as either an application or an applet, the performance is great. However, when I try to deploy it with WebStart, the performance is terrible, a database lookup taking 40 secs to 1 minute, when a lookup would previously take 5-10 seconds. Has anyone else seen this? The hang up is in the DBConnect function listed bleow:
         public boolean DBConnect (String DBHost) {               
              String DBConnStr = DBHost;
              boolean ret = true;
              try {
                   url = new URL(DBConnStr);
              } catch (Exception ex) {
                   ret = false;
                   System.out.println("Failed to create URL " + url.toString());
              try {
                   con = (java.net.HttpURLConnection) url.openConnection();
                   con.setDoOutput(true);
                   con.setUseCaches(false); // to ensure that we do contact
                                                                     // the servlet and don't get
                                                                     // anything from the browser's
                                                                     // cache
                   con.setDoInput(true); // only if reading response
                   con.connect();
              } catch (Exception ex) {
                   ret = false;
                   System.out.println("Failed to connect to db servlet...");
              return ret;
    Thanks,
    Dan

    Hi
    I want to access a servlet from a WS Application and have performance problem Where did you set SecurityManager to null? In the servlet, or in your WS-Application?
    If I set the SecurityManager to null in the Application which should access the servlet, I can't start the Application (and it is o.k). After that I tryed in the servlet as follow:
    System.setSecurityManager(null);But, after that it wasn't better. Could you show me, how did you set SecurityManager to null (and where).
    Thanks a lot.
    P.S. In the WebStart I tryed two options: Proxi: withoutand Proxi:Webbrowser directBut it didin't help to.

  • 5.1 Servlet Performance

    Using Weblogic 5.1 SP3 under Solaris 2.7
    We are using the native Performance Pack which allocates 3 Posix readers
    can we or should we tune this??? Appears this is per cpu limit.
    We have an unusual situation where we want to essentially do an long
    running post so we can stream data back to a client much like a file
    transfer.
    What we are seeing is that depending on the number of Execute Threads we
    see the first say 12 Clients - (Using Execute Thread Count 15) start and
    we dont see our other say 288 clients until each of our 12 clients are
    almost finished
    processing.
    It would appear that the cpu allocation timeslice is not switiching
    between concurrent http clients effectively if the servlets are long
    running.
    Is there some tunning which can be done to change this???
    I know this is an unusual situation but given the nature of
    firewalls/proxyservers/load balancing hardware like ArrowPoint,F5 etc we
    need to try to use http vs native
    t3 protocol out to our clients who will be both jfc and web based.
    Any help in this area would be greatly appreciated.
    NOTE: Also set weblogic.system.acceptBacklog=100
    Still CPU is pegged. Sparc ultra 5.

    Larry,
    There are a couple of issues here.
    First a little bit of info about how the performance pack and execute
    threads are related. The performance pack is a bit of code which uses the
    POSIX poll() call to determine when a given socket has data available and
    can thus be read from without blocking. The POSIX reader threads then make
    the actual call to read() and if enough data has been sent (in the case of
    HTTP the request line and all of the headers) then the request is enqueued.
    The execute threads pull the request off and call the service() method of
    the appropriate servlet. So for your situation changing the number of POSIX
    reader threads won't help, but as you'll see below increasing the number of
    execute threads will.
    Once the service() method has been called on the servlet there is very
    little the container can do besides wait for that call to return. It can't
    reclaim the thread because the servlet specification mandates a synchronous
    model; the service() method must run to completion at which point the
    request is flushed and the thread can be re-assigned. If we were to somehow
    reclaim the thread in the middle of the service() call, the call stack and
    by consequence all of the lexically scoped variables would be lost and there
    would be no way of resuming the service() call later. Lisp and other
    languages have ways of packaging up the current call stack such that one
    could do this, but for better or worse Java does not.
    The fact that the servlet specification is like this makes some sense
    because it is much easier to write synchronous programs than asynchronous
    ones. Further since HTTP is fundamentally a synchronous protocol it is a
    pretty good fit for most uses. Neither HTTP nor servlets were really
    designed to be used in the manner you describe.
    So what can you do? There are a number of options I can think of.
    1. Increase the number of execute threads to the number of simultaneous
    clients. This the easiest thing because it only requires a configuration
    change. The downside is that it won't scale to thousands of clients per
    server. Most VMs fall over, or at least get really slow, when you use that
    many threads.
    2. Use our HTTP tunneling support. It doesn't suffer from this problem.
    When you are making your initial JNDI connection just specify http: as the
    protocol rather than t3:.
    3. Batch data on the server and have the client poll periodically to
    retrieve it.
    4. In an upcoming release we may provide support for an asynchronous
    servlet programming model. If you are interested in hearing more about this
    send me mail and we can discuss.
    Regards,
    Adam

  • Real world performance/speed difference between 3ghz and 3.2

    Hello,
    I have a 2008, (not clovertown) Harpertown 3.0ghz Mac Pro. I wanted to know if its feasible to upgrade the cpus to the 3.2 ones? Also, what is the REAL WORLD speed/performance difference between the 3.0 and 3.2? I am so stressed out over this that I really need to have an answer to this.
    Not that I am going to buy the 3.2 processors, just wanting to see what I am missing here in terms of percentage overall between my mac pro and a 3.2ghz mac pro from 2008.
    Thank you,

    You realize that by now you can probably guess what some of our answers might be?
    Real world... well, in the real world you drive to work stuck in traffic most of the time, too.
    Spend your money on a couple new solid state drives.
    You want this for intellectual curiosity, so look at your Geekbench versus others.

  • What is the impact of using a variant data type on performance, speed memory demands etc?

    This is another one of my "lets get this settled once and for all" threads.
    I have avoided variant data types whenever possible to keep the performance of my apps up. From some observatsions i have made over the years, I am of the opinion that;
    1) In-place operations can not be carried out on variants.
    2) Passing a variant to a sub-VI (regardless of the terminal on the icon connector) are always copied.
    I would like confirmation or correction of the above so we know more about this animal we call LabVIEW.
    Thank you,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Solved!
    Go to Solution.

    A couple notes:
    1. You can use the To/From Variant nodes for the Inplace Element Structure to operate inplace on the contained variant data. This should work just fine even if you have a big 2D array contained.
    2. Variants are incredibly useful when you use them for Variant Attributes, rather than just storing data. The Variant Attribute implementation uses a binary tree to store the key value pairs, which provides quick insertion and lookup.
    3. I don't work on the internals of LV, but I see no reason whatsoever that passing a variant into a subVI would always necessitate a copy. I could be wrong, but that sounds very odd to me.
    However, I have generally started trending towards using flattened strings. Flattened strings are generally more efficient memory-wise, because they don't contain all the type descriptor information, just the raw data. (I think there's some exception when flattening LV Classes.) Variants always store the type descriptor, so even an empty variant can take up a bit of memory.
    Variants received a big performance boost from 7.x to 8.x. They used to have a bad reputation, but I wouldn't be afraid to use them where applicable. I personally don't see a lot of benefits over flattened strings, though, except in the case of tools like the OpenG Variant INI files, which can dynamically parse out and construct variant types.
    Jarrod S.
    National Instruments

  • Performance, Speed Tutorials

    Anyone know any good online tutorials that emphasize performance techniques and fine tuning for faster code?

    Try this one
    http://java.sun.com/docs/books/performance/
    This one was really great!!! Anyone know any others?

  • Performance speeds Tiger vs. Leopard

    I know others have asked but they did not get any in depth answer.
    http://discussions.apple.com/thread.jspa?threadID=2718028
    I have a 1.25 Emac, with 1Gb RAM. Tiger runs fine and all, minus flash video, but the upgrade path on the software end is starting to dwindle. (for instance iTunes)
    With the same hardware set up how much of a performance change would I see running X.5?
    I have heard conflicting stories. And if I bumped it up to 1.5GB would the performance increase be notable.

    Years ago there was a work around for turning off Quartz Extreme on older versions of OSX
    I believe you are thinking of another QE issue. QE was not supported for PCI video cards like in the G3 minitowers and the first G4s. QE would, by default only work with an AGP video card. There was a hack to change QE support from AGP to a PCI card. It worked but w could cause other PCI cards to stop working.
    Having uses a PCI G3 lacking QE support for years, trust me when I say you do NOT want it turned off. 2D actions like scrolling and dragging are miserable.
    I agree with the wise Hobo--Dashboard remains running in the background once you activate it. Widgets that have to "phone home" regularly (site monitoring widgets; web cam widgets; some weather widgets) can eat a lot of resources. YOu can either completely disable Dashboard or, what I did: get the amazingly useful widget DashQuit:
    http://www.apple.com/downloads/dashboard/status/dashquit_berenguierduncan.html
    It lets you use Dashboard and then turn it off with a click. Very nice to have. Lets you get the benefit from widgets without paying the performance price when you are done widgeting.
    I don't consider Spotlight a big resource hog except when you first upgrade the system. I upgraded my G4 tower from 10.4 to 10.5 last evening and the initial Spotlight indexing ran for several hours. Now it's finished and things are back to normal. With normal computing patterns, Spotlight will run only for short intervals. The only times I had it seem obvious after the initial indexing was when I moved a larger number of files from a backup drive to my boot volume.

  • Servlet Container Speed

    I've just started with JSF and wrote a small application. Everything is working just fine, but I've noticed that it takes an extremely long time (nearly 30 seconds) for the first page to load. Once the page loads, the application runs just fine.
    I am running the application through the current JWSD Tomcat implementation. I've also noticed that the cardemo and other demos exhibit the same characteristic.
    Has anyone else experienced this?

    I'll try messing around with that. I just found it odd, because my Faces app only contained 4 jsps and 6 classes yet it took 30 seconds to run. And not only the first time, everytime on a fresh load (close the browser, open the browser and enter the URL). I have a large JSP/Servlet app with over 100 jsps and many, many servlets & beans and it loads in maybe 2 seconds (if that) in the same environment.
    This slow load applies to all the faces demos packaged with the JDWSP as well as my app and a few other demos I have found.

  • Is Using Static functions advisable from performance(speed) point of view

    I was wondering if using a static function would be slower than using a normal function, especially when the function is to be accessed by multiple threads since the same memory area is used each time the static function is accessed from any of the threads. Thus is it right if I say that static functions are not suitable for multiThreaded access ?

    I was wondering if using a static function would be
    slower than using a normal function,Static functions are linked at compile time, while normal functions have to be linked based on the runtime type of the object they are called on. This lookup means that static function invocations are likely to be faster.
    especially when
    the function is to be accessed by multiple threads
    since the same memory area is used each time the
    static function is accessed from any of the threads.If you are talking about the code segment, where the function definition is held, there is only a single copy of each "normal" function as well. The code segment is also read-only, so there are no issues with multiple threads reading and executing the same code at the same time.
    There are the normal issues with multi-threaded access to variables in static functions that exist with normal functions.
    Thus is it right if I say that static functions are
    not suitable for multiThreaded access ?Static functions are no safer than non-static functions in terms of thread safety. On the other hand, it is no more dangerous having multiple threads calling a static function than having multiple threads calling a non-static function on the same object. Exactly the same thread safety techniques apply whether you are working in a static or a non-static context.
    With the above in mind, there is a great deal of design difference between static functions and non-static functions. They mean very different things when creating a system, and an operation that is suited for a static function is very likely not appropriate in a non-static context, and vice versa. The important thing is to make sure the design is appropriate for what the system is trying to do.
    The most common use of static functions is for object creation... The Factory design pattern uses static methods to create objects of a given type, the Singleton design pattern uses static methods to allow access to itself.

  • How is the processing speed while using struts,spring,and JSF framework

    Hi friends,
    As per earlier technology like Servlets,I mean that there would have much more performance speed than other new technologies like JSP,struts,spring and hibernate framework.Because,in new technologies,flow of processings implicitly via MVC2 basis will probably much more time than older one.
    Total goal is only for attaining MVC2 or any other purpose?
    Please clarify my doubt?
    With Regards,
    Stalin.G

    Home grown applications have a problem in that as more and more features are added, it becomes increasingly impossible to maintain the application and enhance it. This is especially true when the original programmers leave the company. A framework provides a standard design approach that other programmers can hopefully more easily pick up.
    A lot of work has gone into creating these frameworks and they have been used in web sites that have millions of hits from users per day. They have high preformance. Of course, programmers can still write bad code in them that slows down the system. I believe anyone using these frameworks should study them well before using them (such as reading books on them).

  • Poor Performance after start up and Frequent Crashes

    I have a brand new imac i order a little over 6 months ago, i immediately migrated my old imac's files to the new mac and everything worked great but then slowly began to degrade in performance and now i have nothing but problems that have gotten worse.
    The first problem occurred with a slow performance speed after about a month of amazing performance.
    Then I noticed the new magic mouse i had ordered with the computer would lose connection with the computer causing it to crash, also the new mouse would not hold a charge for long. My last magic mouse did not have this issue.
    My computer would fall asleep and then i could be unable to wake it by using my mouse, even plugging in an apple pro wired mouse would not work, i had to turn the power on and off to restart
    My bluetooth was acting funny trying to connect to devices i hadn't authorized
    Then came a kernel crash.
    Then came apple 3 tired support who after weeks of diagnosis over the phone were stumped.
    I tried the following to fix the problems myself:
    reset the Pram
    Repaired Disk Permissions
    Checked the hardware
    reinstalled the OS
    Checked for and installed all software updates
    Reset the SMC
    Ran 3rd party software "mackeeper" to optimize my files and check for viruses
    Clean up unneeded files so plenty of memory
    And finally downloaded a 3rd part program called "idrefrag" to defrag my system files.
    nothing worked
    I was unable to take additional time to deal with the issue, i work and attend school online and was extremely busy during the summer so i had to just deal with the issues because being without my computer was not an option i had.
    After my busy summer ended, the problems had only gotten worse
    Now, not only does the mac fall asleep and not wake up and not respond to the magic mouse to wake up or reconnect when the mouse and mac lose signal, but now when i plug in a usb flash drive to my external flash drive port, it's like playing russian roulette, half the time it's fine, the other half the computer freeze upon insertion of the drive. I shouldn't have so much anxiety plugging in a 8gb flash drive.
    but now on to the worst part, before the summer when i had to restart after crashes it was normal, but now when i restart, the computer acts like it has to remember how to even be a computer again. Upon restarting after the classic Mac tone:
    My mac desktop begins to reload, although the icons on the top right appear then disappear and then appear to load back up very slowly.
    Moving files to another folder or tp the trash is painstakingly slow, i get a message saying "preparing to move file" that goes on for 10 minutes.
    Simple tasks like trying to copy and paste or access my "places" on the side bar like "movies, "Pictures" etc cause a pinwheel and then each "place" has to load all the files as if it's searching the computer for them all before i have access to them, this can take 5-10 minutes
    When i click on an application from the dock to load, it just bounces for a while and then finally starts up but takes 5 minutes or more to be able to access without a pinwheel
    Overall the computer basically forgets how to be a computer and has to relearn how to do the simplest tasks, the next 24 hours is plagued by pinwheels and slow performance and then it acts fine again, but i can never shut it down or it start all over again, so i just let it fall asleep when not in use and cross my fingers that when i come back it will respond to the mouse and wake up, half the time it does, the other half, i have to restart by holding the power button down and then pressing it to start up again.
    I had to just adapt, so i have a good system down now and so when I restart i run the system disk utility and repair the HD 1 & 2 's permission which always seems to have a lot of issues and that kinda helps speed along the 24 hour relearning process. But i shouldn't have to do all this stuff, i spent 3,000 on this computer, i bought all the upgrades and after a couple of months of amazing performance i was left with a time bomb and 3 tier apple support who have no idea where to go and now wont even call me back despite my paying for 4 years of apple care, I am at a total loss of what to do, i can't afford to send the machine off for diagnosis and repair and frankly think Apple should send me a new machine since not only does the mac itself present problems, but so does the new magic mouse, and the rechargeable batteries and charger i purchased from them as well.
    My Mac info:
    Mac OS X Version 10.6.8
    Model Name:          iMacModel Identifier:          iMac12,1
    Processor Name:          Intel Core i7
    Processor Speed:          2.8 GHz
    Number of Processors:          1
    Total Number of Cores:          4
    L2 Cache (per Core):          256 KB
    L3 Cache:          8 MB
    Memory:          16 GB
    Serial -ATA
    any suggestions?

    Thats a shame, you should be enjoying your mac!, what was the final outcome of the Apple support guys?. I think if it were me and i had tried tried everything that you have including the support tech. i would be pressing for a replacement mac.

  • I am desperate!! slow choppy network speeds (not actual inability to cnnct)

    I have a 13" macbook air that has the following problem: I can connect to wifi networks (including at home WPA and also tried WPA2 settings) but even though I may get proper speed at first, I soon lose that and it becomes much slower and choppy (if I open activity monitor I can see the speed going up and down like crazy...). My internet speed at home is 12mpbs set by my provider. When I perform speed tests (vis speedtest.net or downloading files from other speed test sites) on my windows PC that is also on this network I get the full download speed. However with this MAC while I initially did get the full speed, it is now down to an average of 3-5mbps and the activity monitor, again, shows choppy behavior so it will be at 8 then at zero almost and then up and down again but never near the full speed. I tried to connect to other networks and I have the same problem - once this happens it stays. I tried removing the airport connection in network preferences and adding it again it does not help.
    I TALKED TO APPLE AND HAD MY COMPUTER TESTED BY THEM - they didn't find any hardware issues (they said it was fine - but it isn't) but they still replaced the airport hardware in the computer - both the chip and the antenna (which meant replacing the entire screen). I brought the computer home, ran a speed test and everything was fine. I thought GREAT but then something happened and the problem returned. What I did (which I think was unrelated) was connect via SMB to a PC at home and I tried to stream a movie file. I noticed it kept 'pausing' so I opened up activity monitor again and to my HORROR I saw the choppy wave with network speed very inconsistent going up and down like crazy... I tried connecting to my slingox using the sling web access after disconnecting from my home PC but got partial speed and lots of drops too. I tried the speed test again multiple times, nothing seems to work.
    SO I don't know what to do at this point. I have 10.6.6 running. I heard something about a firmware update but I am new to mac so not sure how to even do that or what else I can do to solve this problem or what is causing it. BTW - logging in now from the guest account still does not fix the issues and they remain the same.
    I am desperately looking for help!!
    Thanks a lot!

    Have you been able to reproduce your problems on other wireless networks other than at your house? It appears you are saying that this occurs on all wireless, but I'm not sure from your comment. If it's only at home, it would appear to be a compatibility issue between your wireless access point and the Macbook Air, which isn't uncommon. Sometimes a firmware upgrade to the access point can fix it, sometimes it might require switching to a different brand of access point. It would be great if you could borrow (or buy and return) a different access point/router to test. An Apple airport would be the best to use of course. Not the easiest solution, but lets you help rule out a hardware issue with your air.
    My isp provides 15mbps but my wireless devices such as my iphone, ipad, laptop usually only get 6.5-8 mbps when testing speeds to the internet. I don't expect it to be as good as the wired due to interference, signal, etc. I don't get the choppy behavior however. Firware updates from Apple will appear in the same manner as standard software updates. If there is one available for your system it should appear when you check for software updates. That being said, I believe you can also manually download them from the Apple site.

Maybe you are looking for