• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Performance issue while sending mails

 
Ranch Hand
Posts: 69
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am not sure in which forum i am supposed to post this question, i am assuming it as a performance issue and hence posting it here.

We have an application where we need to share some video playlists to users.We send the URL of the video to the users through emails and most of the times same URL is shared to many users(we have a textbox kind of thing where multiple email ids are entered and an "e-mail is sent" message displayed once all the emails are sent). The users will open the mail and click the URL to access the playlist.But there is a catch , when the user clicks on the link from email he is redirected to login page where his email id is pre -populated in user name(as non editable text). In our current implementation we are generating a random key for each of the email ids and appending the key to the URL.Based on that key we populate the email in login page.But as you can imagine as number email ids increases the generation of key for each user is taking a lot of time and the process of sending email is delayed.This approach was already implemented by my "seniors" and they are not willing to change it.But i just cant stop thinking is there any better way to accomplish the above task without generating a seperate key for each email id and yet somehow we need to know form which email that URL is being accessed.

Thanks,
Udaya Krishna
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

But as you can imagine as number email ids increases the generation of key for each user is taking a lot of time and the process of sending email is delayed.


Why is this? The amount of time it takes to create a key should not depend on the number of email addresses there are; it should be constant. Also, instead of creating the key every time you send an email, you could create it just once when the user registers (and maybe have a background job that creates new keys every so often if that is deemed necessary).

I'm guessing the key is an encrypted or hashed version of the email address? How many email addresses are we talking about? And how long does it take to generate these keys? And, taking a step back, compared to sending out the emails I would imagine that generating the keys takes a miniscule amount of time. Not to mention that -this being email- it shouldn't really matter whether they go out a minute sooner or later, yes?
 
udaya krishna
Ranch Hand
Posts: 69
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ulf for the response.
I think I am not able to convey my point properly.Let me gave an example , suppose the URL of the playlist of I need to share is :
www.mywebsite.com/videos/myplaylist1 ,

I have an admin who wants to share this URL via my application , my application has an UI which accepts comma seperated email ids and the UI also has the text area where he can paste the above URL, and clicks on "Send" button.Till the mails are sent "Sending.." message is shown.Suppose 2 email ids are entered 2 different keys are generated and is appended to the actual URL , so the actual URL that would be sent to say abc@email.com and xyz@email.com is:

www.mywebsite.com/videos/myplaylist1+someKey (for abc@email.com) and
www.mywebsite.com/videos/myplaylist1+someOtherkey.( xyz@email.com) so on.

we store both email and key in different columns of a database table.
So when the user(the one who recieved the email) clicks on the URL , the user is directed to login page with the email prepopulated in the username textbox based on the key appended,

So the thing is for every email id we are generating a unique key.So as the number of email ids increase the time taken to generate a key for each and every email id is taking time. As far as i know the whole approach of this design might be flawed.But i cannot think of any other way of prepopulating the email id.Hope I am a litlle more clearer now.

Thanks
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the email address is the username for the login, then I don't see why the key could not be generated and stored in the DB right when the user account is created. There should not be a need to generate it over and over again each time a mail is sent.

I'm still not clear what the performance issue is, exactly. Again: how long does it take to generate the key on the fly? How many email addresses can someone possibly enter manually?

But taking a step back: making a web user wait until such an operation is finished is not a good way to design a UI. What if the browser times out the request? Or the server? What if the user accidentally closes the page? The usual approach to this would be to start a background job, which could then either send an email to the admin once it's done that contains all the details of what happened, or there could be a web page the admin can go to that summarizes the background activity while and after it's going on.
 
udaya krishna
Ranch Hand
Posts: 69
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The point of generating key while sending the mail rather than when creating the user is that , this feature is basically to market the site , so the email ids which would be entered are the new ones and do not exist in the list of current users.The user may or may not access the website by clicking the link sent in email.So we have no option but to generate keys seperately.

Thanks
Udaya Krishna
 
udaya krishna
Ranch Hand
Posts: 69
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And yes , we have an address book kind of thing which has a list of existing users , so that will add up as well .
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand how a user could login with his email address as the username if the email address has never before been in the system.

But you still haven't told us why generating those keys takes so long. It sounds like a simple process that should take tiny fractions of a second.
 
udaya krishna
Ranch Hand
Posts: 69
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We provide a temporary login with a temporary role , through which he can access only that particular playlist , however on full time registration he can access all the playlists .And the time tken is too long because we are doing lot of validations like if the email id is valid , there are no duplicate email ids .So the key generation might not be the "only" reason for the delay.Basically I am looking for a better approach where I can prepopulae the email id in login page.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then I would advise not to do this while the admin waits for the web page to finish, and instead push it into the background as I described two posts back.
 
udaya krishna
Ranch Hand
Posts: 69
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes may be a scheduler kind of thing that picks up the email from a queue.Thanks a lot
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic