prmr / Creco

Recommendation System for Consumer Products
Apache License 2.0
6 stars 2 forks source link

Application Fails on Concurrent Access #81

Closed prmr closed 10 years ago

prmr commented 10 years ago

Steps to reproduce: In a browser (I tested with Firefox 27.0):

  1. Open two separate tabs
  2. In one tab search for "Humidifier"
  3. In the other tab search for "apple"
  4. Come back to the first tab and select the "Humidifier" category. You should get an HTTP 500 error.
priyasidhaye commented 10 years ago

I ran the application on two different tabs and searched 'Toaster' and 'Humidifier'. It was working fine, but after checking a couple of features on each and clicking submit on first the 'Toaster' tab and second on the 'Humidifier' tab the 'Humidifier' tab products changed to the 'Toaster' search ones. This was on Chrome.

prmr commented 10 years ago

This now appears to be fixed by the new SiteController in branch 75, but I'll test some more before closing.

nishanthtgwda commented 10 years ago

The application seems to freeze (no sorting) during concurrent access.

  1. Tab 1 : Smart phone Tab 2: Humidifiers
  2. Select some attributes in tab 1 and products get sorted on every select/deselect.
  3. Select some attributes in tab 2 and products get sorted on every select/deselect.
  4. Come back to tab 1 and any select/deselect will not result in new list of sort products [display freezed on product side].
    .
ceipher commented 10 years ago

@priyasidhaye can you merge the SiteController ASAP?

enewe101 commented 10 years ago

Hey @ceipher -- I want to put a problem that I noticed on your radar. I think that this would be addressed by the solution to this issue. I'll describe it as a test-case:

In fact this delay is not due to waiting for an ajax request, it's due to a script grabbing all the browser's resources. This must be the re-sorting script doing an order n^2 matching. The fact that there are so many toasters is what kills us.

I think it will get fixed with the changes we discussed, which prevents the need for client-side matching. So this is just a test-case to be aware of!

priyasidhaye commented 10 years ago

Hi, yes I will merge master into SiteController now.

On Fri, Apr 4, 2014 at 4:04 PM, enewe101 notifications@github.com wrote:

TODO - handle null search case for categories

Reply to this email directly or view it on GitHubhttps://github.com/prmr/Creco/issues/81#issuecomment-39605603 .

forgues commented 10 years ago

I don't think the delay is caused by ranking and sorting the products. Both of those things happen in the ProductRanker class. I added a debug log at the beginning and the end of the ranking method, and both of the logs appear almost immediately (and simultaneously) in the console. But even when the console indicates the ranking/sorting is done, the website's list is only updated 1-2 seconds later.

enewe101 commented 10 years ago

@forgues -- yup you're right, not because of server-side rank/sort, I meant on the client side...

In order to deal with thymeleaf binding problems, the client executes a javascript that takes the sorted result from the server and then compares it to the DOM, and figures out which products that already exist on the page match which products in the new ordering, then shuffles them around into new spots. So it's a lot of jQuery juggling, which can get expensive.

ceipher commented 10 years ago

When I was fixing the problem ,I noticed more and more places where we saved the dangerous important value in the server, such as aScoredAttr. So that it is not even a session issue, but the sever holds the categoryId for every client

ceipher commented 10 years ago

As a result, we should not set ANY variable in the SiteController or Facade. Only service object is allowed.

ceipher commented 10 years ago

The problem has been fixed and merged in master. @enewe101 after a few code cleans, I will close this issue.

ceipher commented 10 years ago

Done

enewe101 commented 10 years ago

Looks great! This seems to alleviate the issues with updating features in categories that have lots of products (e.g. the side-by-side refrigerator). It will be even better when we limit number of products returned by the server.

I can see you have to re-create the spinner elements after clearing the products div and loading new products -- does that take care of the issue @priyasidhaye posted on #87?

ceipher commented 10 years ago

cannot reproduce the #87 issue either on firefox, I think it should solve that