Foren

Import 60.000 users

Gabriel BZ, geändert vor 13 Jahren.

Import 60.000 users

New Member Beiträge: 8 Beitrittsdatum: 09.03.10 Neueste Beiträge
Hi,

I need to imnport about 60.000 users from excel. I saw is possible by web service (tunnel-web/axis), but the performance (with SOAP) may not be good.

I know insert directly in database strategy may infer in data consistency cause relations and lucene index will be affected.

What better solution in this case?

thanks!
Eliseu Rocha, geändert vor 13 Jahren.

RE: Import 60.000 users

New Member Beiträge: 3 Beitrittsdatum: 03.11.10 Neueste Beiträge
Have u considered develop a portlet, that uploads your file (xls), and create the user using UserLocalServiceUtil (Liferay API)

The main code (of this aproach) is something like this:

- read csv(xls) to a variable reader (Class CsvReader or something else...)
- then execute this code...

User userToCreate = UserLocalServiceUtil.createUser(userId)

...
userToCreate.setEmailAddress(reader.get("email"));
userToCreate.setPassword(reader.get("pass"));
userToCreate.setScreenName(reader.get("ScreenName"));
userToCreate.setActive(true);
...

try {

User createdUser = UserLocalServiceUtil.addUser(userToCreate);

}
catch(Exception ex)
{
//
}


If this is viable to you, tell me something, i can give u some more details.

Regards,

Eliseu Rocha
Gabriel BZ, geändert vor 13 Jahren.

RE: Import 60.000 users

New Member Beiträge: 8 Beitrittsdatum: 09.03.10 Neueste Beiträge
Hi Eliseu, thanks for reply,

I can do this, i will make a test, but I'm not sure about performance, there are too many users!

[]'s
thumbnail
Peter Shin, geändert vor 13 Jahren.

RE: Import 60.000 users

Regular Member Beiträge: 121 Beitrittsdatum: 24.09.07 Neueste Beiträge
regarding performance, this may speed things up a lil

BatchSessionUtil.setEnabled(true);

try {
	// your code here
}
finally {
	BatchSessionUtil.setEnabled(false);
}
Gabriel BZ, geändert vor 13 Jahren.

RE: Import 60.000 users

New Member Beiträge: 8 Beitrittsdatum: 09.03.10 Neueste Beiträge
Thanks Peter,

I have imported 40.000 users (120.000 records in database, considering tables contact_, group_ e user_) in 2 hours. I think performance was very good.

[]'s
thumbnail
Ahmed Hasan, geändert vor 10 Jahren.

RE: Import 60.000 users

Expert Beiträge: 306 Beitrittsdatum: 13.04.07 Neueste Beiträge
Hi Gabriel,

I am sure you've gone with the WS approach. I liked the portlet approach as it will greatly improve the performance. But since this is a one time activity, you should go ahead writing a simple java program that does this by iterating thru the records of the excel sheet and uploading the user by invoking the web service.

Yours truly,
Ahamed Hasan
Author, Liferay Portlet Cookbook
thumbnail
technology evangelist, geändert vor 10 Jahren.

RE: Import 60.000 users

Junior Member Beiträge: 35 Beitrittsdatum: 02.08.13 Neueste Beiträge
Eliseu Rocha:
Have u considered develop a portlet, that uploads your file (xls), and create the user using UserLocalServiceUtil (Liferay API)

The main code (of this aproach) is something like this:

- read csv(xls) to a variable reader (Class CsvReader or something else...)
- then execute this code...

User userToCreate = UserLocalServiceUtil.createUser(userId)

...
userToCreate.setEmailAddress(reader.get("email"));
userToCreate.setPassword(reader.get("pass"));
userToCreate.setScreenName(reader.get("ScreenName"));
userToCreate.setActive(true);
...

try {

User createdUser = UserLocalServiceUtil.addUser(userToCreate);

}
catch(Exception ex)
{
//
}


If this is viable to you, tell me something, i can give u some more details.

Regards,

Eliseu Rocha



HI Eliseu Rocha,
Check Below forum post and give suggestion to clear my task

https://www.liferay.com/community/forums/-/message_boards/message/15591927