4

I am trying to send requests using JMeter to my application that is running on localhost but many of the requests get failed due to java.net.SocketException. I do not see any exceptions in console though.

I read these question1 and question2 but did not help much.

My code is as following:

 try {
        return myService.findItems(group);

    } catch (NullPointerException n) {
        n.printStackTrace();
    } catch (HibernateException h) {
        h.printStackTrace();
    } catch (IOException i) {
        i.printStackTrace();
    }
    return null;

Repository

  public LinkedHashMap findItems(String group) throws NullPointerException, HibernateException, IOException {
        Session session = sessionFactory.getCurrentSession();
                 ..... //request is sent to database

        return items;
    }

Screen shots of my JMeter configuration

enter image description here

enter image description here

enter image description here

enter image description here

Community
  • 1
  • 1
Jack
  • 5,526
  • 22
  • 68
  • 141
  • The service you are connecting to appears not to be an HTTP server, or else you are somehow sending a malformed request. – user207421 Jun 10 '15 at 05:00

2 Answers2

13

From Screenshots you provided, I think either you thought your system/localhost as super computer or you have mis-configured the jmeter settings.

Screenshot shows, 10000 users/threads will start in 1 second which is completely unreal for application running on a localhost. Jmeter alone will eat most CPU, memory i.e. system resources.

If your Jmeter is eating all resources will your application will get anything (Simple answer is NO) Thus application will go down and you will start getting timeout errors or socket exceptions.

If you have jmeter and application on diff machines then still 10000 users in 1 second is very high load for a normal application and it is obvious that you will face such errors. Try running test with realistic load that is expected for your application with given hw. Maybe 100 users in 1 second and gradually increase them to expected value.

I hope you understood it now :)

Nachiket Kate
  • 8,039
  • 2
  • 24
  • 42
0

SocketException means network problem. check you running server status.

Jiang YD
  • 2,918
  • 1
  • 10
  • 17
  • I am running the application on localhost, please clarify what you mean by 'checking you running server status' – Jack Jun 10 '15 at 01:02
  • I am on mac is there any alternative? Are you sure nothing is wrong with the code? – Jack Jun 10 '15 at 01:25
  • no, not problem of your code. i not know mac, may be google it for a way to check your localhost listening ports and check. – Jiang YD Jun 10 '15 at 01:38