掲示板

Liferay 6.2 add user slow

7年前 に Marc Benji によって更新されました。

Liferay 6.2 add user slow

New Member 投稿: 17 参加年月日: 10/06/21 最新の投稿
Hi all,

i've a problem with add user service in database with many records.
Our database is Oracle 10g and we have 200.000 users and we want to load other 2.000.000 users. When we try to insert via Liferay's service insert query takes longer than 20 seconds.

I've try to insert these properties but we have not found benefits

users.indexer.enabled=false
users.search.with.index=false


Can someone help me to solve this issue?
thumbnail
7年前 に Olaf Kock によって更新されました。

RE: Liferay 6.2 add user slow

Liferay Legend 投稿: 6403 参加年月日: 08/09/23 最新の投稿
Marc Benji:

Our database is Oracle 10g and we have 200.000 users and we want to load other 2.000.000 users. When we try to insert via Liferay's service insert query takes longer than 20 seconds.


Is that 20 seconds per user? Or do you have batches for a number of users?

Keep in mind that the default password hashing is deliberately slow (but safe) - for a mass import, this will place a significant burden in case you are importing the passwords in clear text and hash them during the import.

You might also want to keep an eye on your database (what does it do - what do the execution plans and query explanations say? It might be the read operations, it might be inefficient write operations. And, for the question "why is my code slow", some code to comment on typically helps as well.
7年前 に Marc Benji によって更新されました。

RE: Liferay 6.2 add user slow

New Member 投稿: 17 参加年月日: 10/06/21 最新の投稿
Thank you for your answer Olaf.
Our problems are present in production environment because Liferay is configured to import users from LDAP to login. We also have other portlets that implement the add user but the result is always the same. Sometimes the response times are around 5/7 minutes.
To avoid this problem we decided to preload users on Liferay, but the response times are directly proportional to the number of records in the database. For preloading we decided to use the utility of loading liferay from LDAP when the server starts but before we start we decided to carry out tests by placing 10000 users via WebService with this code

private void insertIntoLiferay() throws IOException {
		ServiceContext ctx = new ServiceContext();
		BufferedReader br = null;
		try {
			Portal_UserServiceSoapBindingStub stub = new Portal_UserServiceSoapBindingStub(new URL("http://host:port/api/axis/Portal_UserService"), null);
		
			br = new BufferedReader(new FileReader(new File("C:/users.csv")));
			String line;
			int i=0;
			while ((line = br.readLine()) != null) {
				try {
					String[] split = line.split(";");
					String password = split[0];
					String username = split[1];
					String name = split[2];
					String surname = split[3];
					i++;
					long timeStart = System.currentTimeMillis();
					stub.setUsername("admin");
					stub.setPassword("admin");
					long companyId = 10157;
					long groupId = 11051;
					ctx.setIndexingEnabled(false);
					stub.addUser(companyId, false, password, password, false, username, username+"@test.com", 0, null, "en_US", name, 
							"", surname, 0, 0, true, 1, 1, 1970, null, new long[]{groupId}, null, null, 
							null, new AddressSoap[]{}, new EmailAddressSoap[]{}, new PhoneSoap[]{}, new WebsiteSoap[]{}, new AnnouncementsDeliverySoap[]{}, false, ctx);
					long timeEnd = System.currentTimeMillis();
					double elapsedSeconds = (timeEnd-timeStart) / 1000.0;
					System.out.println("Row number: "+i+" - Elapsed time: "+elapsedSeconds+" seconds");
				} catch (AxisFault e) {
					e.printStackTrace();
				} catch (RemoteException e) {
					e.printStackTrace();
				} catch (Exception ex) {
					ex.printStackTrace();

				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();

		} finally {
			if(br != null)
				br.close();
		}
	}
7年前 に Deependra Singh によって更新されました。

RE: Liferay 6.2 add user slow

New Member 投稿: 19 参加年月日: 13/11/13 最新の投稿
Hi,

Please use the below properties to improve the user creation performance.
Include this property in the Portal-ext.properties.

table.mapper.cacheless.mapping.table.names=User_,\
UserGroup,\
UserGroupGroupRole,\
UserGroupRole,\
UserGroups_Teams,\
Users_Groups,\
Users_Orgs,\
Users_Roles,\
Users_Teams,\
Users_UserGroups

Steps to measure the improvement
1. Create one user from control panel/ application and note the elapse time(total time taken) for the process.
2. Apply the property in the Portal-ext.properties.
3. Create another user from control panel/ application and note the elapse time for the process.
4. Compare the elapse time

Please share the result after test
7年前 に Marc Benji によって更新されました。

RE: Liferay 6.2 add user slow

New Member 投稿: 17 参加年月日: 10/06/21 最新の投稿
Deependra Singh:

table.mapper.cacheless.mapping.table.names=User_,\
UserGroup,\
UserGroupGroupRole,\
UserGroupRole,\
UserGroups_Teams,\
Users_Groups,\
Users_Orgs,\
Users_Roles,\
Users_Teams,\
Users_UserGroups


Sorry but i don't see these property in portal.properties. I think this is an old property
7年前 に Deependra Singh によって更新されました。

RE: Liferay 6.2 add user slow

New Member 投稿: 19 参加年月日: 13/11/13 最新の投稿
Hi,

This is not an old property. This property we had added to resolve the issue during our performance test.
This property need to added in the portal-ext.properties.
Can add the property in lower environment like UAT or QA and test.

We are using Liferay 6.2 EE on JBoss server with Oracle.
7年前 に Marc Benji によって更新されました。

RE: Liferay 6.2 add user slow

New Member 投稿: 17 参加年月日: 10/06/21 最新の投稿
Deependra Singh:
Hi,

This is not an old property. This property we had added to resolve the issue during our performance test.
This property need to added in the portal-ext.properties.
Can add the property in lower environment like UAT or QA and test.

We are using Liferay 6.2 EE on JBoss server with Oracle.



Thank you but doesn't work with Liferay 6.2 CE
7年前 に Deependra Singh によって更新されました。

RE: Liferay 6.2 add user slow

New Member 投稿: 19 参加年月日: 13/11/13 最新の投稿
Hi,

As After applying the property there is no effect on the user creation performance on 6.2 CE version so Can you share more detail about the environment like :
1. Is there is any patch applied on the environment?
2. Which SP version is running on Production?
3. While creating users are we interacting with any external systems other than liferay?